X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftlist%2Ftest%2Frun.c;h=06732cc3c1e1b32dccc79677c4c42043c0a77e7d;hp=f94438eaf69551bc117754143d554ee9246ca326;hb=d81e79b8dfdfb0da8766c022e767a5b040e5d07b;hpb=c23a40c7f1ac9fad0146b46988a41f196aae933f diff --git a/ccan/tlist/test/run.c b/ccan/tlist/test/run.c index f94438ea..06732cc3 100644 --- a/ccan/tlist/test/run.c +++ b/ccan/tlist/test/run.c @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) unsigned int i; struct tlist_children tlist = TLIST_INIT(tlist); - plan_tests(48); + plan_tests(60); /* Test TLIST_INIT, and tlist_empty */ ok1(tlist_empty(&tlist)); ok1(tlist_check(&tlist, NULL)); @@ -41,6 +41,8 @@ int main(int argc, char *argv[]) ok1(c2.list.prev == &parent.children.raw.n); ok1(parent.children.raw.n.next == &c2.list); ok1(parent.children.raw.n.prev == &c2.list); + ok1(tlist_next(&parent.children, &c2, list) == NULL); + ok1(tlist_prev(&parent.children, &c2, list) == NULL); /* Test tlist_check */ ok1(tlist_check(&parent.children, NULL)); @@ -54,6 +56,10 @@ int main(int argc, char *argv[]) ok1(parent.children.raw.n.prev == &c2.list); ok1(c1.list.next == &c2.list); ok1(c1.list.prev == &parent.children.raw.n); + ok1(tlist_next(&parent.children, &c1, list) == &c2); + ok1(tlist_next(&parent.children, &c2, list) == NULL); + ok1(tlist_prev(&parent.children, &c2, list) == &c1); + ok1(tlist_prev(&parent.children, &c1, list) == NULL); /* Test tlist_check */ ok1(tlist_check(&parent.children, NULL)); @@ -69,6 +75,12 @@ int main(int argc, char *argv[]) ok1(c2.list.prev == &c1.list); ok1(c3.list.next == &parent.children.raw.n); ok1(c3.list.prev == &c2.list); + ok1(tlist_next(&parent.children, &c1, list) == &c2); + ok1(tlist_next(&parent.children, &c2, list) == &c3); + ok1(tlist_next(&parent.children, &c3, list) == NULL); + ok1(tlist_prev(&parent.children, &c3, list) == &c2); + ok1(tlist_prev(&parent.children, &c2, list) == &c1); + ok1(tlist_prev(&parent.children, &c1, list) == NULL); /* Test tlist_check */ ok1(tlist_check(&parent.children, NULL));