Skip to content

Commit 5c26abd

Browse files
author
Elizabeth Ventura
committed
test high memory and array read.
1 parent 2ad0131 commit 5c26abd

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

SampleProjects/TestSomething/test/eeprom.cpp

+14-6
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,22 @@ unittest(writeRead)
2323
assertEqual(24, a);
2424

2525
EEPROM.write(0, 128);
26-
uint8_t b = EEPROM.read(0);
27-
assertEqual(128, b);
26+
a = EEPROM.read(0);
27+
assertEqual(128, a);
2828

29-
// this will fail since it is out of bound (0 - 255)
3029
EEPROM.write(0, 256);
31-
uint8_t c = EEPROM.read(0);
32-
assertEqual(256, c);
30+
a = EEPROM.read(0);
31+
assertEqual(0, a);
3332

33+
int addr = EEPROM_SIZE / 2;
34+
EEPROM.write(addr, 63);
35+
a = EEPROM.read(addr);
36+
assertEqual(63, a);
37+
38+
addr = EEPROM_SIZE - 1;
39+
EEPROM.write(addr, 188);
40+
a = EEPROM.read(addr);
41+
assertEqual(188, a);
3442
}
3543

3644
unittest(updateWrite)
@@ -55,7 +63,7 @@ unittest(array)
5563
{
5664
int val = 10;
5765
EEPROM[2] = val;
58-
uint8_t a = EEPROM.read(2);
66+
uint8_t a = EEPROM[2];
5967
assertEqual(10, a);
6068
}
6169

0 commit comments

Comments
 (0)