@@ -43,7 +43,8 @@ void setup()
43
43
if (myMem.begin () == false )
44
44
{
45
45
Serial.println (" No memory detected. Freezing." );
46
- while (1 );
46
+ while (1 )
47
+ ;
47
48
}
48
49
Serial.println (" Memory detected!" );
49
50
@@ -93,8 +94,10 @@ void setup()
93
94
byte response2 = myMem.read (randomLocation + 1 );
94
95
Serial.println (" Location " + (String)randomLocation + " should be " + (String)myValue1 + " : " + (String)response1);
95
96
Serial.println (" Location " + (String)(randomLocation + 1 ) + " should be " + (String)myValue2 + " : " + (String)response2);
96
- if (myValue1 != response1) allTestsPassed = false ;
97
- if (myValue2 != response2) allTestsPassed = false ;
97
+ if (myValue1 != response1)
98
+ allTestsPassed = false ;
99
+ if (myValue2 != response2)
100
+ allTestsPassed = false ;
98
101
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
99
102
100
103
Serial.println (" " );
@@ -124,8 +127,10 @@ void setup()
124
127
myMem.get (randomLocation + 2 , response4);
125
128
Serial.println (" Location " + (String)randomLocation + " should be " + (String)myValue3 + " : " + (String)response3);
126
129
Serial.println (" Location " + (String)(randomLocation + 2 ) + " should be " + (String)myValue4 + " : " + (String)response4);
127
- if (myValue3 != response3) allTestsPassed = false ;
128
- if (myValue4 != response4) allTestsPassed = false ;
130
+ if (myValue3 != response3)
131
+ allTestsPassed = false ;
132
+ if (myValue4 != response4)
133
+ allTestsPassed = false ;
129
134
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
130
135
131
136
Serial.println (" " );
@@ -155,8 +160,10 @@ void setup()
155
160
myMem.get (randomLocation + 4 , response6);
156
161
Serial.println (" Location " + (String)randomLocation + " should be " + (String)myValue5 + " : " + (String)response5);
157
162
Serial.println (" Location " + (String)(randomLocation + 4 ) + " should be " + (String)myValue6 + " : " + (String)response6);
158
- if (myValue5 != response5) allTestsPassed = false ;
159
- if (myValue6 != response6) allTestsPassed = false ;
163
+ if (myValue5 != response5)
164
+ allTestsPassed = false ;
165
+ if (myValue6 != response6)
166
+ allTestsPassed = false ;
160
167
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
161
168
162
169
// int32_t and uint32_t sequential test
@@ -179,8 +186,10 @@ void setup()
179
186
myMem.get (randomLocation + 4 , response8);
180
187
Serial.println (" Location " + (String)randomLocation + " should be " + (String)myValue7 + " : " + (String)response7);
181
188
Serial.println (" Location " + (String)(randomLocation + 4 ) + " should be " + (String)myValue8 + " : " + (String)response8);
182
- if (myValue7 != response7) allTestsPassed = false ;
183
- if (myValue8 != response8) allTestsPassed = false ;
189
+ if (myValue7 != response7)
190
+ allTestsPassed = false ;
191
+ if (myValue8 != response8)
192
+ allTestsPassed = false ;
184
193
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
185
194
186
195
// float (32) sequential test
@@ -204,8 +213,10 @@ void setup()
204
213
myMem.get (randomLocation + 4 , response10);
205
214
Serial.println (" Location " + (String)randomLocation + " should be " + (String)myValue9 + " : " + (String)response9);
206
215
Serial.println (" Location " + (String)(randomLocation + 4 ) + " should be " + (String)myValue10 + " : " + (String)response10);
207
- if (myValue9 != response9) allTestsPassed = false ;
208
- if (myValue10 != response10) allTestsPassed = false ;
216
+ if (myValue9 != response9)
217
+ allTestsPassed = false ;
218
+ if (myValue10 != response10)
219
+ allTestsPassed = false ;
209
220
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
210
221
211
222
Serial.println (" " );
@@ -215,7 +226,7 @@ void setup()
215
226
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
216
227
Serial.println (" Size of double: " + (String)sizeof (double ));
217
228
double myValue11 = -290.3485723409857 ;
218
- double myValue12 = 384.957 ;// 34987;
229
+ double myValue12 = 384.957 ; // 34987;
219
230
double myValue13 = 917.14159 ;
220
231
double myValue14 = 254.8877 ;
221
232
randomLocation = random (0 , myMem.length ());
@@ -249,14 +260,18 @@ void setup()
249
260
Serial.print (" Rewrite of " );
250
261
Serial.print (myMem.length () - sizeof (myValue14));
251
262
Serial.println (" should be " + (String)myValue14 + " : " + (String)response14);
252
- if (myValue11 != response11) allTestsPassed = false ;
253
- if (myValue12 != response12) allTestsPassed = false ;
254
- if (myValue13 != response13) allTestsPassed = false ;
255
- if (myValue14 != response14) allTestsPassed = false ;
263
+ if (myValue11 != response11)
264
+ allTestsPassed = false ;
265
+ if (myValue12 != response12)
266
+ allTestsPassed = false ;
267
+ if (myValue13 != response13)
268
+ allTestsPassed = false ;
269
+ if (myValue14 != response14)
270
+ allTestsPassed = false ;
256
271
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
257
272
258
273
Serial.println (" " );
259
- Serial.println (" String test " );
274
+ Serial.println (" Buffer Write Test " );
260
275
261
276
// Buffer write test
262
277
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -292,12 +307,13 @@ void setup()
292
307
293
308
Serial.println ();
294
309
Serial.print (" Memory Contents:" );
295
- for (uint16_t x = 0 ; x < 32 * 4 ; x ++)
310
+ for (uint16_t x = 0 ; x < 32 * 4 ; x++)
296
311
{
297
312
if (x % 16 == 0 )
298
313
Serial.println ();
299
314
Serial.print (" 0x" );
300
- if (myMem.read (x) < 0x10 ) Serial.print (" 0" );
315
+ if (myMem.read (x) < 0x10 )
316
+ Serial.print (" 0" );
301
317
Serial.print (myMem.read (x), HEX);
302
318
}
303
319
Serial.println ();
@@ -310,5 +326,4 @@ void setup()
310
326
311
327
void loop ()
312
328
{
313
-
314
329
}
0 commit comments