@@ -45,6 +45,11 @@ ble_store_test_util_verify_peer_deleted(const ble_addr_t *addr)
4545 rc = ble_store_read (BLE_STORE_OBJ_TYPE_CCCD , & key , & value );
4646 TEST_ASSERT (rc == BLE_HS_ENOENT );
4747
48+ memset (& key , 0 , sizeof key );
49+ key .feat .peer_addr = * addr ;
50+ rc = ble_store_read (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT , & key , & value );
51+ TEST_ASSERT (rc == BLE_HS_ENOENT );
52+
4853 rc = ble_store_util_bonded_peers (addrs , & num_addrs ,
4954 sizeof addrs / sizeof addrs [0 ]);
5055 TEST_ASSERT_FATAL (rc == 0 );
@@ -198,6 +203,16 @@ TEST_CASE_SELF(ble_store_test_delete_peer)
198203 .chr_val_handle = 5 ,
199204 },
200205 };
206+ struct ble_store_value_cl_sup_feat feats [2 ] = {
207+ {
208+ .peer_addr = secs [0 ].peer_addr ,
209+ .peer_cl_sup_feat [0 ] = 0 ,
210+ },
211+ {
212+ .peer_addr = secs [1 ].peer_addr ,
213+ .peer_cl_sup_feat [0 ] = 0 ,
214+ },
215+ };
201216 union ble_store_value value ;
202217 union ble_store_key key ;
203218 int count ;
@@ -218,6 +233,11 @@ TEST_CASE_SELF(ble_store_test_delete_peer)
218233 TEST_ASSERT_FATAL (rc == 0 );
219234 }
220235
236+ for (i = 0 ; i < sizeof feats / sizeof feats [0 ]; i ++ ) {
237+ rc = ble_store_write_peer_cl_sup_feat (feats + i );
238+ TEST_ASSERT_FATAL (rc == 0 );
239+ }
240+
221241 /* Delete first peer. */
222242 rc = ble_store_util_delete_peer (& secs [0 ].peer_addr );
223243 TEST_ASSERT_FATAL (rc == 0 );
@@ -254,6 +274,16 @@ TEST_CASE_SELF(ble_store_test_delete_peer)
254274 TEST_ASSERT_FATAL (rc == 0 );
255275 TEST_ASSERT (memcmp (& value .cccd , cccds + 2 , sizeof value .cccd ) == 0 );
256276
277+ ble_store_key_from_value_peer_cl_sup_feat (& key .feat , feats + 1 );
278+
279+ rc = ble_store_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT , & count );
280+ TEST_ASSERT_FATAL (rc == 0 );
281+ TEST_ASSERT (count == 1 );
282+
283+ rc = ble_store_read_peer_cl_sup_feat (& key .feat , & value .feat );
284+ TEST_ASSERT_FATAL (rc == 0 );
285+ TEST_ASSERT (memcmp (& value .feat , feats + 1 , sizeof value .feat ) == 0 );
286+
257287 /* Delete second peer. */
258288 rc = ble_store_util_delete_peer (& secs [1 ].peer_addr );
259289 TEST_ASSERT_FATAL (rc == 0 );
@@ -294,6 +324,16 @@ TEST_CASE_SELF(ble_store_test_count)
294324 .chr_val_handle = 8 ,
295325 },
296326 };
327+ struct ble_store_value_cl_sup_feat feats [2 ] = {
328+ {
329+ .peer_addr = secs [0 ].peer_addr ,
330+ .peer_cl_sup_feat [0 ] = 0 ,
331+ },
332+ {
333+ .peer_addr = secs [1 ].peer_addr ,
334+ .peer_cl_sup_feat [0 ] = 0 ,
335+ },
336+ };
297337 int count ;
298338 int rc ;
299339 int i ;
@@ -314,6 +354,10 @@ TEST_CASE_SELF(ble_store_test_count)
314354 TEST_ASSERT_FATAL (rc == 0 );
315355 TEST_ASSERT (count == 0 );
316356
357+ rc = ble_store_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT , & count );
358+ TEST_ASSERT_FATAL (rc == 0 );
359+ TEST_ASSERT (count == 0 );
360+
317361 /* Write some test data. */
318362
319363 for (i = 0 ; i < 3 ; i ++ ) {
@@ -328,6 +372,10 @@ TEST_CASE_SELF(ble_store_test_count)
328372 rc = ble_store_write_cccd (cccds + i );
329373 TEST_ASSERT_FATAL (rc == 0 );
330374 }
375+ for (i = 0 ; i < 1 ; i ++ ) {
376+ rc = ble_store_write_peer_cl_sup_feat (feats + i );
377+ TEST_ASSERT_FATAL (rc == 0 );
378+ }
331379
332380 /*** Verify counts after populating store. */
333381 rc = ble_store_util_count (BLE_STORE_OBJ_TYPE_OUR_SEC , & count );
@@ -342,6 +390,10 @@ TEST_CASE_SELF(ble_store_test_count)
342390 TEST_ASSERT_FATAL (rc == 0 );
343391 TEST_ASSERT (count == 1 );
344392
393+ rc = ble_store_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT , & count );
394+ TEST_ASSERT_FATAL (rc == 0 );
395+ TEST_ASSERT (count == 1 );
396+
345397 ble_hs_test_util_assert_mbufs_freed (NULL );
346398}
347399
@@ -383,6 +435,16 @@ TEST_CASE_SELF(ble_store_test_clear)
383435 .chr_val_handle = 5 ,
384436 },
385437 };
438+ struct ble_store_value_cl_sup_feat feats [2 ] = {
439+ {
440+ .peer_addr = secs [0 ].peer_addr ,
441+ .peer_cl_sup_feat [0 ] = 0 ,
442+ },
443+ {
444+ .peer_addr = secs [1 ].peer_addr ,
445+ .peer_cl_sup_feat [0 ] = 0 ,
446+ },
447+ };
386448 int rc ;
387449 int i ;
388450
@@ -400,27 +462,36 @@ TEST_CASE_SELF(ble_store_test_clear)
400462 TEST_ASSERT_FATAL (rc == 0 );
401463 }
402464
465+ for (i = 0 ; i < sizeof feats / sizeof feats [0 ]; i ++ ) {
466+ rc = ble_store_write_peer_cl_sup_feat (feats + i );
467+ TEST_ASSERT_FATAL (rc == 0 );
468+ }
469+
403470 /* Sanity check. */
404471 TEST_ASSERT_FATAL (
405472 ble_store_test_util_count (BLE_STORE_OBJ_TYPE_OUR_SEC ) == 2 );
406473 TEST_ASSERT_FATAL (
407474 ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_SEC ) == 2 );
408475 TEST_ASSERT_FATAL (
409476 ble_store_test_util_count (BLE_STORE_OBJ_TYPE_CCCD ) == 3 );
477+ TEST_ASSERT_FATAL (
478+ ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT ) == 2 );
410479
411480 /* Ensure store is empty after clear gets called. */
412481 rc = ble_store_clear ();
413482 TEST_ASSERT_FATAL (rc == 0 );
414483 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_OUR_SEC ) == 0 );
415484 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_SEC ) == 0 );
416485 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_CCCD ) == 0 );
486+ TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT ) == 0 );
417487
418488 /* Ensure second clear succeeds with no effect. */
419489 rc = ble_store_clear ();
420490 TEST_ASSERT_FATAL (rc == 0 );
421491 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_OUR_SEC ) == 0 );
422492 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_SEC ) == 0 );
423493 TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_CCCD ) == 0 );
494+ TEST_ASSERT (ble_store_test_util_count (BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT ) == 0 );
424495
425496 ble_hs_test_util_assert_mbufs_freed (NULL );
426497}
0 commit comments