X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Flist%2Ftest%2Frun.c;h=1a5f093470da87e13912f0ac4ee26bcf83a0e0d2;hb=c44953a9b9e6114690968294662fc5120e674cd2;hp=66b9630db514610ac9d78c76212492e39b6465ca;hpb=650c775ff00cccd03fc84e7789a03c51d9839004;p=ccan diff --git a/ccan/list/test/run.c b/ccan/list/test/run.c index 66b9630d..1a5f0934 100644 --- a/ccan/list/test/run.c +++ b/ccan/list/test/run.c @@ -1,6 +1,6 @@ -#include "list/list.h" -#include "tap/tap.h" -#include "list/list.c" +#include +#include +#include struct parent { const char *name; @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) struct child c1, c2, c3, *c, *n; unsigned int i; - plan_tests(41); + plan_tests(44); /* Test LIST_HEAD, list_empty and check_list */ ok1(list_empty(&static_list)); ok1(list_check(&static_list, NULL)); @@ -74,6 +74,9 @@ int main(int argc, char *argv[]) /* Test list_top */ ok1(list_top(&parent.children, struct child, list) == &c1); + /* Test list_tail */ + ok1(list_tail(&parent.children, struct child, list) == &c3); + /* Test list_for_each. */ i = 0; list_for_each(&parent.children, c, list) { @@ -114,5 +117,9 @@ int main(int argc, char *argv[]) } ok1(i == 3); ok1(list_empty(&parent.children)); + + /* Test list_top/list_tail on empty list. */ + ok1(list_top(&parent.children, struct child, list) == NULL); + ok1(list_tail(&parent.children, struct child, list) == NULL); return exit_status(); }