forked from FabioBatSilva/ArduinoFake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_eeprom.h
33 lines (26 loc) · 984 Bytes
/
test_eeprom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifdef UNIT_TEST
namespace EEPROMTest {
#include "arduino/EEPROM.h"
void test_basics(void) {
When(OverloadedMethod(ArduinoFake(EEPROM), read, uint8_t(int)))
.AlwaysReturn();
When(OverloadedMethod(ArduinoFake(EEPROM), write, void(int, uint8_t)))
.AlwaysReturn();
When(OverloadedMethod(ArduinoFake(EEPROM), update, void(int, uint8_t)))
.AlwaysReturn();
When(OverloadedMethod(ArduinoFake(EEPROM), length, uint16_t(void)))
.AlwaysReturn();
EEPROM.read(1);
EEPROM.write(1, 1);
EEPROM.update(1, 2);
EEPROM.length();
Verify(OverloadedMethod(ArduinoFake(EEPROM), read, uint8_t(int))).Once();
Verify(OverloadedMethod(ArduinoFake(EEPROM), write, void(int, uint8_t)))
.Once();
Verify(OverloadedMethod(ArduinoFake(EEPROM), update, void(int, uint8_t)))
.Once();
Verify(OverloadedMethod(ArduinoFake(EEPROM), length, uint16_t(void))).Once();
}
void run_tests() { RUN_TEST(EEPROMTest::test_basics); }
} // namespace EEPROMTest
#endif