From 013981b79b66ace7bfa478f81bde2970d5bad78b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 22 Nov 2020 19:07:05 +0100 Subject: [PATCH] tests: list: test 'empty' predicate --- tests/list.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/list.c b/tests/list.c index 7ed3549..6bce41e 100644 --- a/tests/list.c +++ b/tests/list.c @@ -265,6 +265,20 @@ Test(list, pop_back) { assert_list(arr, ARR_SIZE(arr) - 1, 0); } +Test(list, empty_null) { + cr_assert(list_empty(NULL)); +} + +Test(list, empty_none) { + cr_assert(list_empty(&(struct list){ NULL })); +} + +Test(list, empty_one) { + struct int_list l = { 0, { &l.list, &l.list } }; + + cr_assert_not(list_empty(&(struct list){ &l.list })); +} + Test(list, length_null) { cr_assert_eq(list_length(NULL), 0); }