sys: lists: Add tests for newly-added list len functions
This commit adds tests for the newly added list len APIs to the corresponding test cases. It is noted that the test functions calculate equivalent values manually using several different internal list functions. This has been left unmodified to ensure that the manual ways using each of the various for_each functions results in the same value as the new list_len() functions. Signed-off-by: J M <montytyper@msn.com>
This commit is contained in:
parent
dbb786dae1
commit
9cf437728e
3 changed files with 24 additions and 0 deletions
|
@ -39,6 +39,10 @@ static inline bool verify_emptyness(sys_dlist_t *list)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_dlist_len(list) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_DLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
@ -97,6 +101,10 @@ static inline bool verify_content_amount(sys_dlist_t *list, int amount)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_dlist_len(list) != amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_DLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
|
|
@ -40,6 +40,10 @@ static inline bool verify_emptyness(sys_sflist_t *list)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_sflist_len(list) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_SFLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
@ -98,6 +102,10 @@ static inline bool verify_content_amount(sys_sflist_t *list, int amount)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_sflist_len(list) != amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_SFLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
|
|
@ -40,6 +40,10 @@ static inline bool verify_emptyness(sys_slist_t *list)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_slist_len(list) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_SLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
@ -98,6 +102,10 @@ static inline bool verify_content_amount(sys_slist_t *list, int amount)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sys_slist_len(list) != amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
SYS_SLIST_FOR_EACH_NODE(list, node) {
|
||||
count++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue