tests: Add test for wl_list_length

list-test.c did not cover wl_list_length, so add one test that specifically
tests this method.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Yong Bakos 2016-09-04 13:23:05 -07:00 committed by Pekka Paalanen
parent d9ef882139
commit 2bdbb741e2

View File

@ -57,6 +57,19 @@ TEST(list_insert)
assert(e.link.prev == &list); assert(e.link.prev == &list);
} }
TEST(list_length)
{
struct wl_list list;
struct element e;
wl_list_init(&list);
assert(wl_list_length(&list) == 0);
wl_list_insert(&list, &e.link);
assert(wl_list_length(&list) == 1);
wl_list_remove(&e.link);
assert(wl_list_length(&list) == 0);
}
TEST(list_iterator) TEST(list_iterator)
{ {
struct wl_list list; struct wl_list list;