@@ -133,9 +133,17 @@ static void nvstore_basic_functionality_test()
133
133
result = nvstore.set (19 , 10 , &(nvstore_testing_buf_set[3 ]));
134
134
TEST_ASSERT_EQUAL (NVSTORE_ALREADY_EXISTS, result);
135
135
136
- result = nvstore.set_alloc_key (key, 17 , &(nvstore_testing_buf_set[ 3 ]) );
136
+ result = nvstore.allocate_key (key, 3 );
137
137
TEST_ASSERT_EQUAL (NVSTORE_NUM_PREDEFINED_KEYS, key);
138
138
TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
139
+ result = nvstore.set (NVSTORE_NUM_PREDEFINED_KEYS, 17 , &(nvstore_testing_buf_set[3 ]));
140
+ TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
141
+
142
+ result = nvstore.allocate_key (key, 3 );
143
+ TEST_ASSERT_EQUAL (NVSTORE_NUM_PREDEFINED_KEYS + 1 , key);
144
+ TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
145
+ result = nvstore.set (NVSTORE_NUM_PREDEFINED_KEYS + 1 , 17 , &(nvstore_testing_buf_set[3 ]));
146
+ TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
139
147
140
148
// Make sure set items are also gotten OK after reset
141
149
result = nvstore.deinit ();
@@ -168,6 +176,20 @@ static void nvstore_basic_functionality_test()
168
176
TEST_ASSERT_EQUAL (17 , actual_len_bytes);
169
177
TEST_ASSERT_EQUAL_UINT8_ARRAY (&nvstore_testing_buf_set[3 ], nvstore_testing_buf_get, 17 );
170
178
179
+ result = nvstore.get (NVSTORE_NUM_PREDEFINED_KEYS + 1 , 64 , nvstore_testing_buf_get, actual_len_bytes);
180
+ TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
181
+ TEST_ASSERT_EQUAL (17 , actual_len_bytes);
182
+ TEST_ASSERT_EQUAL_UINT8_ARRAY (&nvstore_testing_buf_set[3 ], nvstore_testing_buf_get, 17 );
183
+
184
+ result = nvstore.free_all_keys_by_owner (3 );
185
+ TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
186
+
187
+ result = nvstore.get (NVSTORE_NUM_PREDEFINED_KEYS, 64 , nvstore_testing_buf_get, actual_len_bytes);
188
+ TEST_ASSERT_EQUAL (NVSTORE_NOT_FOUND, result);
189
+
190
+ result = nvstore.get (NVSTORE_NUM_PREDEFINED_KEYS + 1 , 64 , nvstore_testing_buf_get, actual_len_bytes);
191
+ TEST_ASSERT_EQUAL (NVSTORE_NOT_FOUND, result);
192
+
171
193
result = nvstore.get (10 , 65 , nvstore_testing_buf_get, actual_len_bytes);
172
194
TEST_ASSERT_EQUAL (NVSTORE_SUCCESS, result);
173
195
TEST_ASSERT_EQUAL (64 , actual_len_bytes);
@@ -346,6 +368,12 @@ static void nvstore_basic_functionality_test()
346
368
TEST_ASSERT_EQUAL (53 , actual_len_bytes);
347
369
TEST_ASSERT_EQUAL_UINT8_ARRAY (&(nvstore_testing_buf_set[10 ]), nvstore_testing_buf_get, 53 );
348
370
371
+ result = nvstore.get (NVSTORE_NUM_PREDEFINED_KEYS, 64 , nvstore_testing_buf_get, actual_len_bytes);
372
+ TEST_ASSERT_EQUAL (NVSTORE_NOT_FOUND, result);
373
+
374
+ result = nvstore.get (NVSTORE_NUM_PREDEFINED_KEYS + 1 , 64 , nvstore_testing_buf_get, actual_len_bytes);
375
+ TEST_ASSERT_EQUAL (NVSTORE_NOT_FOUND, result);
376
+
349
377
delete[] nvstore_testing_buf_set;
350
378
delete[] nvstore_testing_buf_get;
351
379
}
0 commit comments