summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYong Bakos <ybakos@humanoriented.com>2016-09-04 13:23:05 -0700
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-09-05 15:10:43 +0300
commit2bdbb741e2ac0ec9ecc564463a59b3ef8f499f6a (patch)
treed1112a531598a8d5aa9743c92f6bc24490852283
parentd9ef882139e6178edf68c3fce147afdb3b57b894 (diff)
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>
-rw-r--r--tests/list-test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/list-test.c b/tests/list-test.c
index 21ca4ec..0752618 100644
--- a/tests/list-test.c
+++ b/tests/list-test.c
@@ -57,6 +57,19 @@ TEST(list_insert)
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)
{
struct wl_list list;