Add tlmConfirm to tlm_dl ota packet-structure (#2991)
[ExpressLRS.git] / src / test / test_embedded / eeprom_tests.h
blob0213b4d25f64cf00b420ab89b772d216a5f7fe44
1 #include <Arduino.h>
2 #include <unity.h>
3 #include "elrs_eeprom.h"
5 ELRS_EEPROM eeprom;
7 void test_eeprom_rw(void)
9 // TEST CASE:
10 // GIVEN the eeprom object has been initialised
11 // WHEN the write method is called using a valid address and value
12 // THEN the value is stored at that address in eeprom
14 // Initialise the eeprom
15 eeprom.Begin();
17 uint8_t address;
18 uint8_t value;
19 uint8_t success;
21 // Write the first value variable into the eeprom at the specified address
22 address = 1;
23 value = 1;
24 eeprom.WriteByte(address, value);
26 // Assert that value in eeprom matches what was written
27 TEST_ASSERT_EQUAL(value, eeprom.ReadByte(address));
29 // Write the second value variable into the eeprom at the specified address
30 address = 2;
31 value = 2;
32 eeprom.WriteByte(address, value);
34 // Assert that value in eeprom matches what was written
35 TEST_ASSERT_EQUAL(value, eeprom.ReadByte(address));