File tree 1 file changed +5
-4
lines changed
user/tests/wiring/no_fixture
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -73,17 +73,18 @@ test(EEPROM_02_ReadWriteSucceedsForAllAddressWithInRange) {
73
73
74
74
test (EEPROM_03_ReadWriteFailsForAnyAddressOutOfRange) {
75
75
int EEPROM_SIZE = EEPROM.length ();
76
- uint16_t address = 0 ;
77
- uint8_t base = (uint8_t )rand ();
76
+ int EEPROM_INC = 10 ;
77
+ uint16_t address = EEPROM_SIZE;
78
+ uint8_t base = rand () % (255 - EEPROM_INC - 1 ); // do not allow data to equal 255, which is what EEPROM.read(invalid_address) returns
78
79
uint8_t data = base;
79
80
80
81
// when
81
- for (address=EEPROM_SIZE, data=base; address < EEPROM_SIZE+ 10 ; address++, data++)
82
+ for (address=EEPROM_SIZE, data=base; address < EEPROM_SIZE + EEPROM_INC ; address++, data++)
82
83
{
83
84
EEPROM.write (address, data);
84
85
}
85
86
// then
86
- for (address=EEPROM_SIZE, data=base; address < EEPROM_SIZE+ 10 ; address++, data++)
87
+ for (address=EEPROM_SIZE, data=base; address < EEPROM_SIZE + EEPROM_INC ; address++, data++)
87
88
{
88
89
assertNotEqual (EEPROM.read (address), data);
89
90
}
You can’t perform that action at this time.
0 commit comments