X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftlist%2Ftest%2Frun.c;h=06732cc3c1e1b32dccc79677c4c42043c0a77e7d;hb=516148fb8b14a14bf23a4b732fed2942ca9b8d29;hp=f94438eaf69551bc117754143d554ee9246ca326;hpb=a6b5111fe6948e51114c33aa34785c9fd0d403e6;p=ccan 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));