tests: list: use FOREACH_ENTRY macro
This commit is contained in:
parent
c695a6a774
commit
5a97ab4d37
|
@ -538,13 +538,11 @@ Test(list, filter) {
|
||||||
cr_assert_eq(count, ARR_SIZE(arr));
|
cr_assert_eq(count, ARR_SIZE(arr));
|
||||||
|
|
||||||
size_t count_even = 0;
|
size_t count_even = 0;
|
||||||
LIST_FOREACH_CONST(res, it) {
|
LIST_FOREACH_ENTRY(const struct int_list, list, res, n) {
|
||||||
struct int_list *n = CONTAINER_OF(struct int_list, list, it);
|
|
||||||
cr_assert_eq(n->val, ++count_even * 2);
|
cr_assert_eq(n->val, ++count_even * 2);
|
||||||
}
|
}
|
||||||
size_t count_odd = 0;
|
size_t count_odd = 0;
|
||||||
LIST_FOREACH_CONST(l, it) {
|
LIST_FOREACH_ENTRY(const struct int_list, list, l, n) {
|
||||||
struct int_list *n = CONTAINER_OF(struct int_list, list, it);
|
|
||||||
cr_assert_eq(n->val, ++count_odd * 2 - 1);
|
cr_assert_eq(n->val, ++count_odd * 2 - 1);
|
||||||
}
|
}
|
||||||
cr_assert_eq(count_even + count_odd, ARR_SIZE(arr));
|
cr_assert_eq(count_even + count_odd, ARR_SIZE(arr));
|
||||||
|
|
Loading…
Reference in a new issue