kernel: api: implement test for sys_slist_find
implement test for sys_slist_find signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
This commit is contained in:
parent
8336d8b1e1
commit
d9e9f75bfc
|
@ -184,7 +184,7 @@ static inline bool verify_tail_head(sys_slist_t *list,
|
|||
* @see sys_slist_init(), sys_slist_append(),
|
||||
* sys_slist_find_and_remove(), sys_slist_prepend(),
|
||||
* sys_slist_remove(), sys_slist_get(), sys_slist_get_not_empty(),
|
||||
* sys_slist_append_list(), sys_slist_merge_list()
|
||||
* sys_slist_append_list(), sys_slist_merge_list(), sys_slist_find()
|
||||
*/
|
||||
ZTEST(dlist_api, test_slist)
|
||||
{
|
||||
|
@ -202,6 +202,13 @@ ZTEST(dlist_api, test_slist)
|
|||
&test_node_1.node, true)),
|
||||
"test_list head/tail are wrong");
|
||||
|
||||
/* Find the node 1, previous node should be null */
|
||||
sys_snode_t *test_node_1_prev = &test_node_1.node;
|
||||
|
||||
zassert_true(sys_slist_find(&test_list, &test_node_1.node, &test_node_1_prev),
|
||||
"test_list did not find node ");
|
||||
zassert_is_null(test_node_1_prev, "test_list previous node not null ");
|
||||
|
||||
/* Finding and removing node 1 */
|
||||
sys_slist_find_and_remove(&test_list, &test_node_1.node);
|
||||
zassert_true((verify_emptyness(&test_list)),
|
||||
|
@ -258,6 +265,14 @@ ZTEST(dlist_api, test_slist)
|
|||
&test_node_4.node),
|
||||
"test_list node links are wrong");
|
||||
|
||||
/* Find the node 4 and get the previous node*/
|
||||
sys_snode_t *test_node_4_prev = NULL;
|
||||
|
||||
zassert_true(sys_slist_find(&test_list, &test_node_4.node, &test_node_4_prev),
|
||||
"test_list did not find node");
|
||||
zassert_equal(&test_node_2.node, test_node_4_prev,
|
||||
"test_list previous node wrong ");
|
||||
|
||||
/* Finding and removing node 1 */
|
||||
sys_slist_find_and_remove(&test_list, &test_node_1.node);
|
||||
zassert_true((verify_content_amount(&test_list, 3)),
|
||||
|
|
Loading…
Reference in New Issue