Rtos API example

Embed: (wiki syntax)

« Back to documentation index

add_del.cpp File Reference

add_del.cpp File Reference

Test cases to add and delete key-value pairs in the CFSTORE. More...

Go to the source code of this file.

Functions

control_t cfstore_add_del_test_01_end (const size_t call_count)
 This test case does the following:

  • creates a KV.

control_t cfstore_add_del_test_02_end (const size_t call_count)
 This test case adds a small number of KVs (~3), and then delete them.
control_t cfstore_add_del_test_03_end (const size_t call_count)
 This test case adds ~50 KVs, and then delete entries at the start, middle and end of list.
control_t cfstore_add_del_test_04 (const size_t call_count)
 This test case is as per test_03 but using delete_all() on all init_1 data.
control_t cfstore_add_del_test_05_end (const size_t call_count)
 Delete an attribute after an internal realloc of the cfstore memory area.

Detailed Description

Test cases to add and delete key-value pairs in the CFSTORE.

Please consult the documentation under the test-case functions for a description of the individual test case.

Definition in file add_del.cpp.


Function Documentation

control_t cfstore_add_del_test_01_end ( const size_t  call_count )

This test case does the following:

  • creates a KV.

  • deletes the KV.
  • checks that the deleted KV can no longer be found in the store.
Returns:
on success returns CaseNext to continue to next test case, otherwise will assert on errors.

Definition at line 89 of file add_del.cpp.

control_t cfstore_add_del_test_02_end ( const size_t  call_count )

This test case adds a small number of KVs (~3), and then delete them.

  • add key(s)
  • delete key(s)
  • make sure can't find key in cfstore
  • loop over the above a number of times.
Returns:
on success returns CaseNext to continue to next test case, otherwise will assert on errors.

Definition at line 156 of file add_del.cpp.

control_t cfstore_add_del_test_03_end ( const size_t  call_count )

This test case adds ~50 KVs, and then delete entries at the start, middle and end of list.

Returns:
on success returns CaseNext to continue to next test case, otherwise will assert on errors.

Definition at line 212 of file add_del.cpp.

control_t cfstore_add_del_test_04 ( const size_t  call_count )

This test case is as per test_03 but using delete_all() on all init_1 data.

This test case is yet to be implemented.

Returns:
on success returns CaseNext to continue to next test case, otherwise will assert on errors.

Definition at line 272 of file add_del.cpp.

control_t cfstore_add_del_test_05_end ( const size_t  call_count )

Delete an attribute after an internal realloc of the cfstore memory area.

This test case goes through the following steps: 1. Creates attribute att_1 of size x, and write some data. This causes an internal cfstore realloc to allocate heap memory for the attribute. 2. Allocates some memory on the heap. Typically, this will be immediately after the memory used by cfstore for the KV area. This means that if any cfstore reallocs are made to increase size the memory area will have to move. 3. Creates attribute att_2 of size y. This causes an internal cfstore realloc to move the KV memory area to a new location. 4. Delete att_1. This causes an internal realloc to shrink the area and tests that the internal data structures that contain pointers to different parts of the KV area are updated correctly. 5. Allocates some memory on the heap. If the heap has been corrupted, this will likely trigger a crash

Returns:
on success returns CaseNext to continue to next test case, otherwise will assert on errors.

Definition at line 300 of file add_del.cpp.