Skip to content

Commit 8dc056b

Browse files
Cleaning Preferences Examples
1 parent 3523e59 commit 8dc056b

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

examples/PreferencesCounter/PreferencesCounter.ino

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ void setup() {
2828
while(1) {};
2929
}
3030

31-
// Serial.println(">Clear");
32-
// preferences.clear();
33-
// Serial.println("<Clear");
34-
35-
3631
// Remove all preferences under the opened namespace
3732
//preferences.clear();
3833

examples/PreferencesValidation/test.h

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ bool test_preferences(T value,
2121
// .6 we compare the value with what we inserted at the beginning
2222
// .7 we remove the value
2323

24-
Serial.println("Tesing isKey()");
24+
Serial.println("Testing isKey()");
2525
if(preferences->isKey(KEY)) {
2626
Serial.println("[Error] kvstore already contains a key");
2727
return false;
2828
}
2929

30-
Serial.println("Tesing put()");
30+
Serial.println("Testing put()");
3131
size_t s;
3232
if((s=putf(KEY, value)) != sizeof(value)) {
3333
Serial.println("[Error] kvstore put returned a size that is different from the expected one: ");
@@ -37,13 +37,13 @@ bool test_preferences(T value,
3737
return false;
3838
}
3939

40-
Serial.println("Tesing isKey()"); // FIXME always failing
40+
Serial.println("Testing isKey()");
4141
if(!preferences->isKey(KEY)) {
4242
Serial.println("[Error] The inserted key is not present in the KVStore");
4343
return false;
4444
}
4545

46-
Serial.println("Tesing getf()");
46+
Serial.println("Testing getf()");
4747
T val;
4848
if((val = getf(KEY)) != value) {
4949
Serial.print("[Error] get of the previously value returned a wrong value: ");
@@ -53,7 +53,7 @@ bool test_preferences(T value,
5353
return false;
5454
}
5555

56-
Serial.println("Tesing remove()");
56+
Serial.println("Testing remove()");
5757
if(!preferences->remove(KEY)) {
5858
Serial.println("[Error] Failed removing the inserted key");
5959
return false;
@@ -72,13 +72,13 @@ bool test_preferences(char* value, Preferences *preferences) {
7272
// .6 we compare the value with what we inserted at the beginning
7373
// .7 we remove the value
7474

75-
Serial.println("Tesing isKey()");
75+
Serial.println("Testing isKey()");
7676
if(preferences->isKey(KEY)) {
7777
Serial.println("[Error] kvstore already contains a key");
7878
return false;
7979
}
8080

81-
Serial.println("Tesing put()");
81+
Serial.println("Testing put()");
8282
size_t s;
8383
if((s=preferences->putString(KEY, value)) != strlen(value)) {
8484
Serial.println("[Error] kvstore put returned a size that is different from the expected one: ");
@@ -88,13 +88,13 @@ bool test_preferences(char* value, Preferences *preferences) {
8888
return false;
8989
}
9090

91-
Serial.println("Tesing isKey()");
91+
Serial.println("Testing isKey()");
9292
if(!preferences->isKey(KEY)) {
9393
Serial.println("[Error] The inserted key is not present in the KVStore");
9494
return false;
9595
}
9696

97-
Serial.println("Tesing getf()");
97+
Serial.println("Testing getf()");
9898
char val[500];
9999
preferences->getString(KEY, val, sizeof(val));
100100
if(strcmp(val, value) != 0) {
@@ -116,7 +116,7 @@ bool test_preferences(char* value, Preferences *preferences) {
116116
return false;
117117
}
118118

119-
Serial.println("Tesing remove()");
119+
Serial.println("Testing remove()");
120120
if(!preferences->remove(KEY)) {
121121
Serial.println("[Error] Failed removing the inserted key");
122122
return false;
@@ -134,14 +134,13 @@ bool test_preferences(uint8_t* value, size_t size, Preferences *preferences) {
134134
// .5 we get the value contained
135135
// .6 we compare the value with what we inserted at the beginning
136136
// .7 we remove the value
137-
138-
Serial.println("Tesing isKey()");
137+
Serial.println("Testing isKey()");
139138
if(preferences->isKey(KEY)) {
140139
Serial.println("[Error] kvstore already contains a key");
141140
return false;
142141
}
143142

144-
Serial.println("Tesing put()");
143+
Serial.println("Testing put()");
145144
size_t s;
146145
if((s=preferences->putBytes(KEY, value, size)) != size) {
147146
Serial.println("[Error] kvstore put returned a size that is different from the expected one: ");
@@ -151,13 +150,13 @@ bool test_preferences(uint8_t* value, size_t size, Preferences *preferences) {
151150
return false;
152151
}
153152

154-
Serial.println("Tesing isKey()");
153+
Serial.println("Testing isKey()");
155154
if(!preferences->isKey(KEY)) {
156155
Serial.println("[Error] The inserted key is not present in the KVStore");
157156
return false;
158157
}
159158

160-
Serial.println("Tesing getBytesLength()");
159+
Serial.println("Testing getBytesLength()");
161160
if((s=preferences->getBytesLength(KEY)) != size) {
162161
Serial.println("[Error] The length of the value do not match with the expected one");
163162
Serial.print(s);
@@ -166,7 +165,7 @@ bool test_preferences(uint8_t* value, size_t size, Preferences *preferences) {
166165
return false;
167166
}
168167

169-
Serial.println("Tesing getf()");
168+
Serial.println("Testing getf()");
170169
uint8_t val[500];
171170
s = preferences->getBytes(KEY, val, sizeof(val));
172171

@@ -183,7 +182,7 @@ bool test_preferences(uint8_t* value, size_t size, Preferences *preferences) {
183182
return false;
184183
}
185184

186-
Serial.println("Tesing remove()");
185+
Serial.println("Testing remove()");
187186
if(!preferences->remove(KEY)) {
188187
Serial.println("[Error] Failed removing the inserted key");
189188
return false;

0 commit comments

Comments
 (0)