summaryrefslogtreecommitdiff
path: root/lib/ccan/list/test
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-03-21 00:58:14 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-03-22 01:57:37 +0100
commit675593221c25dbebaaf8e4ce9f4271a8fb0171d0 (patch)
treee1f57a9e3919adb163c0acf1072708aca912945a /lib/ccan/list/test
parenteafd83736918bc5953e4a91cf2d893e68f2da2a2 (diff)
downloadsamba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.tar.gz
samba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.tar.bz2
samba-675593221c25dbebaaf8e4ce9f4271a8fb0171d0.zip
lib/ccan: namespacize ccan/list to avoid conflict with OpenIndiana's sys/list.h
CCAN includes a little utility called "namespacize" which prepends ccan_ to all public methods of a module, and fixes up any dependencies it finds. It's a little primitive, but it works here. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan/list/test')
-rw-r--r--lib/ccan/list/test/compile_ok-constant.c24
-rw-r--r--lib/ccan/list/test/helper.c2
-rw-r--r--lib/ccan/list/test/run-check-corrupt.c28
-rw-r--r--lib/ccan/list/test/run-list_del_from-assert.c18
-rw-r--r--lib/ccan/list/test/run-single-eval.c96
-rw-r--r--lib/ccan/list/test/run.c132
6 files changed, 150 insertions, 150 deletions
diff --git a/lib/ccan/list/test/compile_ok-constant.c b/lib/ccan/list/test/compile_ok-constant.c
index c57cdadc31..acd8601a6b 100644
--- a/lib/ccan/list/test/compile_ok-constant.c
+++ b/lib/ccan/list/test/compile_ok-constant.c
@@ -6,39 +6,39 @@
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
-static bool children(const struct list_head *list)
+static bool children(const struct ccan_list_head *list)
{
- return !list_empty(list);
+ return !ccan_list_empty(list);
}
-static const struct child *first_child(const struct list_head *list)
+static const struct child *first_child(const struct ccan_list_head *list)
{
- return list_top(list, struct child, list);
+ return ccan_list_top(list, struct child, list);
}
-static const struct child *last_child(const struct list_head *list)
+static const struct child *last_child(const struct ccan_list_head *list)
{
- return list_tail(list, struct child, list);
+ return ccan_list_tail(list, struct child, list);
}
-static void check_children(const struct list_head *list)
+static void check_children(const struct ccan_list_head *list)
{
- list_check(list, "bad child list");
+ ccan_list_check(list, "bad child list");
}
-static void print_children(const struct list_head *list)
+static void print_children(const struct ccan_list_head *list)
{
const struct child *c;
- list_for_each(list, c, list)
+ ccan_list_for_each(list, c, list)
printf("%s\n", c->name);
}
int main(void)
{
- LIST_HEAD(h);
+ CCAN_LIST_HEAD(h);
children(&h);
first_child(&h);
diff --git a/lib/ccan/list/test/helper.c b/lib/ccan/list/test/helper.c
index 8903ac1738..f60ecccba7 100644
--- a/lib/ccan/list/test/helper.c
+++ b/lib/ccan/list/test/helper.c
@@ -9,7 +9,7 @@
(42)
struct opaque {
- struct list_node list;
+ struct ccan_list_node list;
size_t secret_offset;
char secret_drawer[42];
};
diff --git a/lib/ccan/list/test/run-check-corrupt.c b/lib/ccan/list/test/run-check-corrupt.c
index 5dd9f9cc83..af44992bfe 100644
--- a/lib/ccan/list/test/run-check-corrupt.c
+++ b/lib/ccan/list/test/run-check-corrupt.c
@@ -28,27 +28,27 @@ static int my_fprintf(FILE *stream, const char *format, ...)
int main(int argc, char *argv[])
{
- struct list_head list;
- struct list_node n1;
+ struct ccan_list_head list;
+ struct ccan_list_node n1;
char expect[100];
plan_tests(9);
/* Empty list. */
list.n.next = &list.n;
list.n.prev = &list.n;
- ok1(list_check(&list, NULL) == &list);
+ ok1(ccan_list_check(&list, NULL) == &list);
/* Bad back ptr */
list.n.prev = &n1;
/* Non-aborting version. */
- ok1(list_check(&list, NULL) == NULL);
+ ok1(ccan_list_check(&list, NULL) == NULL);
/* Aborting version. */
sprintf(expect, "test message: prev corrupt in node %p (0) of %p\n",
&list, &list);
if (setjmp(aborted) == 0) {
- list_check(&list, "test message");
- fail("list_check on empty with bad back ptr didn't fail!");
+ ccan_list_check(&list, "test message");
+ fail("ccan_list_check on empty with bad back ptr didn't fail!");
} else {
ok1(strcmp(printf_buffer, expect) == 0);
}
@@ -58,20 +58,20 @@ int main(int argc, char *argv[])
list.n.prev = &n1;
n1.prev = &list.n;
n1.next = &list.n;
- ok1(list_check(&list, NULL) == &list);
- ok1(list_check_node(&n1, NULL) == &n1);
+ ok1(ccan_list_check(&list, NULL) == &list);
+ ok1(ccan_list_check_node(&n1, NULL) == &n1);
/* Bad back ptr */
n1.prev = &n1;
- ok1(list_check(&list, NULL) == NULL);
- ok1(list_check_node(&n1, NULL) == NULL);
+ ok1(ccan_list_check(&list, NULL) == NULL);
+ ok1(ccan_list_check_node(&n1, NULL) == NULL);
/* Aborting version. */
sprintf(expect, "test message: prev corrupt in node %p (1) of %p\n",
&n1, &list);
if (setjmp(aborted) == 0) {
- list_check(&list, "test message");
- fail("list_check on n1 bad back ptr didn't fail!");
+ ccan_list_check(&list, "test message");
+ fail("ccan_list_check on n1 bad back ptr didn't fail!");
} else {
ok1(strcmp(printf_buffer, expect) == 0);
}
@@ -79,8 +79,8 @@ int main(int argc, char *argv[])
sprintf(expect, "test message: prev corrupt in node %p (0) of %p\n",
&n1, &n1);
if (setjmp(aborted) == 0) {
- list_check_node(&n1, "test message");
- fail("list_check_node on n1 bad back ptr didn't fail!");
+ ccan_list_check_node(&n1, "test message");
+ fail("ccan_list_check_node on n1 bad back ptr didn't fail!");
} else {
ok1(strcmp(printf_buffer, expect) == 0);
}
diff --git a/lib/ccan/list/test/run-list_del_from-assert.c b/lib/ccan/list/test/run-list_del_from-assert.c
index 05d6cad62c..37a37603f6 100644
--- a/lib/ccan/list/test/run-list_del_from-assert.c
+++ b/lib/ccan/list/test/run-list_del_from-assert.c
@@ -9,28 +9,28 @@
int main(int argc, char *argv[])
{
- struct list_head list1, list2;
- struct list_node n1, n2, n3;
+ struct ccan_list_head list1, list2;
+ struct ccan_list_node n1, n2, n3;
pid_t child;
int status;
plan_tests(1);
- list_head_init(&list1);
- list_head_init(&list2);
- list_add(&list1, &n1);
- list_add(&list2, &n2);
- list_add_tail(&list2, &n3);
+ ccan_list_head_init(&list1);
+ ccan_list_head_init(&list2);
+ ccan_list_add(&list1, &n1);
+ ccan_list_add(&list2, &n2);
+ ccan_list_add_tail(&list2, &n3);
child = fork();
if (child) {
wait(&status);
} else {
/* This should abort. */
- list_del_from(&list1, &n3);
+ ccan_list_del_from(&list1, &n3);
exit(0);
}
ok1(WIFSIGNALED(status) && WTERMSIG(status) == SIGABRT);
- list_del_from(&list2, &n3);
+ ccan_list_del_from(&list2, &n3);
return exit_status();
}
diff --git a/lib/ccan/list/test/run-single-eval.c b/lib/ccan/list/test/run-single-eval.c
index f90eed357a..2737bec382 100644
--- a/lib/ccan/list/test/run-single-eval.c
+++ b/lib/ccan/list/test/run-single-eval.c
@@ -5,17 +5,17 @@
struct parent {
const char *name;
- struct list_head children;
+ struct ccan_list_head children;
unsigned int num_children;
int eval_count;
};
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
-static LIST_HEAD(static_list);
+static CCAN_LIST_HEAD(static_list);
#define ref(obj, counter) ((counter)++, (obj))
@@ -26,47 +26,47 @@ int main(int argc, char *argv[])
unsigned int i;
unsigned int static_count = 0, parent_count = 0, list_count = 0,
node_count = 0;
- struct list_head list = LIST_HEAD_INIT(list);
+ struct ccan_list_head list = CCAN_LIST_HEAD_INIT(list);
plan_tests(74);
- /* Test LIST_HEAD, LIST_HEAD_INIT, list_empty and check_list */
- ok1(list_empty(ref(&static_list, static_count)));
+ /* Test CCAN_LIST_HEAD, CCAN_LIST_HEAD_INIT, ccan_list_empty and check_list */
+ ok1(ccan_list_empty(ref(&static_list, static_count)));
ok1(static_count == 1);
- ok1(list_check(ref(&static_list, static_count), NULL));
+ ok1(ccan_list_check(ref(&static_list, static_count), NULL));
ok1(static_count == 2);
- ok1(list_empty(ref(&list, list_count)));
+ ok1(ccan_list_empty(ref(&list, list_count)));
ok1(list_count == 1);
- ok1(list_check(ref(&list, list_count), NULL));
+ ok1(ccan_list_check(ref(&list, list_count), NULL));
ok1(list_count == 2);
parent.num_children = 0;
- list_head_init(ref(&parent.children, parent_count));
+ ccan_list_head_init(ref(&parent.children, parent_count));
ok1(parent_count == 1);
- /* Test list_head_init */
- ok1(list_empty(ref(&parent.children, parent_count)));
+ /* Test ccan_list_head_init */
+ ok1(ccan_list_empty(ref(&parent.children, parent_count)));
ok1(parent_count == 2);
- ok1(list_check(ref(&parent.children, parent_count), NULL));
+ ok1(ccan_list_check(ref(&parent.children, parent_count), NULL));
ok1(parent_count == 3);
c2.name = "c2";
- list_add(ref(&parent.children, parent_count), &c2.list);
+ ccan_list_add(ref(&parent.children, parent_count), &c2.list);
ok1(parent_count == 4);
- /* Test list_add and !list_empty. */
- ok1(!list_empty(ref(&parent.children, parent_count)));
+ /* Test ccan_list_add and !ccan_list_empty. */
+ ok1(!ccan_list_empty(ref(&parent.children, parent_count)));
ok1(parent_count == 5);
ok1(c2.list.next == &parent.children.n);
ok1(c2.list.prev == &parent.children.n);
ok1(parent.children.n.next == &c2.list);
ok1(parent.children.n.prev == &c2.list);
- /* Test list_check */
- ok1(list_check(ref(&parent.children, parent_count), NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(ref(&parent.children, parent_count), NULL));
ok1(parent_count == 6);
c1.name = "c1";
- list_add(ref(&parent.children, parent_count), &c1.list);
+ ccan_list_add(ref(&parent.children, parent_count), &c1.list);
ok1(parent_count == 7);
- /* Test list_add and !list_empty. */
- ok1(!list_empty(ref(&parent.children, parent_count)));
+ /* Test ccan_list_add and !ccan_list_empty. */
+ ok1(!ccan_list_empty(ref(&parent.children, parent_count)));
ok1(parent_count == 8);
ok1(c2.list.next == &parent.children.n);
ok1(c2.list.prev == &c1.list);
@@ -74,15 +74,15 @@ int main(int argc, char *argv[])
ok1(parent.children.n.prev == &c2.list);
ok1(c1.list.next == &c2.list);
ok1(c1.list.prev == &parent.children.n);
- /* Test list_check */
- ok1(list_check(ref(&parent.children, parent_count), NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(ref(&parent.children, parent_count), NULL));
ok1(parent_count == 9);
c3.name = "c3";
- list_add_tail(ref(&parent.children, parent_count), &c3.list);
+ ccan_list_add_tail(ref(&parent.children, parent_count), &c3.list);
ok1(parent_count == 10);
- /* Test list_add_tail and !list_empty. */
- ok1(!list_empty(ref(&parent.children, parent_count)));
+ /* Test ccan_list_add_tail and !ccan_list_empty. */
+ ok1(!ccan_list_empty(ref(&parent.children, parent_count)));
ok1(parent_count == 11);
ok1(parent.children.n.next == &c1.list);
ok1(parent.children.n.prev == &c3.list);
@@ -92,26 +92,26 @@ int main(int argc, char *argv[])
ok1(c2.list.prev == &c1.list);
ok1(c3.list.next == &parent.children.n);
ok1(c3.list.prev == &c2.list);
- /* Test list_check */
- ok1(list_check(ref(&parent.children, parent_count), NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(ref(&parent.children, parent_count), NULL));
ok1(parent_count == 12);
- /* Test list_check_node */
- ok1(list_check_node(&c1.list, NULL));
- ok1(list_check_node(&c2.list, NULL));
- ok1(list_check_node(&c3.list, NULL));
+ /* Test ccan_list_check_node */
+ ok1(ccan_list_check_node(&c1.list, NULL));
+ ok1(ccan_list_check_node(&c2.list, NULL));
+ ok1(ccan_list_check_node(&c3.list, NULL));
- /* Test list_top */
- ok1(list_top(ref(&parent.children, parent_count), struct child, list) == &c1);
+ /* Test ccan_list_top */
+ ok1(ccan_list_top(ref(&parent.children, parent_count), struct child, list) == &c1);
ok1(parent_count == 13);
- /* Test list_tail */
- ok1(list_tail(ref(&parent.children, parent_count), struct child, list) == &c3);
+ /* Test ccan_list_tail */
+ ok1(ccan_list_tail(ref(&parent.children, parent_count), struct child, list) == &c3);
ok1(parent_count == 14);
- /* Test list_for_each. */
+ /* Test ccan_list_for_each. */
i = 0;
- list_for_each(&parent.children, c, list) {
+ ccan_list_for_each(&parent.children, c, list) {
switch (i++) {
case 0:
ok1(c == &c1);
@@ -128,41 +128,41 @@ int main(int argc, char *argv[])
}
ok1(i == 3);
- /* Test list_for_each_safe, list_del and list_del_from. */
+ /* Test ccan_list_for_each_safe, ccan_list_del and ccan_list_del_from. */
i = 0;
- list_for_each_safe(&parent.children, c, n, list) {
+ ccan_list_for_each_safe(&parent.children, c, n, list) {
switch (i++) {
case 0:
ok1(c == &c1);
- list_del(ref(&c->list, node_count));
+ ccan_list_del(ref(&c->list, node_count));
ok1(node_count == 1);
break;
case 1:
ok1(c == &c2);
- list_del_from(ref(&parent.children, parent_count),
+ ccan_list_del_from(ref(&parent.children, parent_count),
ref(&c->list, node_count));
ok1(node_count == 2);
break;
case 2:
ok1(c == &c3);
- list_del_from(ref(&parent.children, parent_count),
+ ccan_list_del_from(ref(&parent.children, parent_count),
ref(&c->list, node_count));
ok1(node_count == 3);
break;
}
- ok1(list_check(ref(&parent.children, parent_count), NULL));
+ ok1(ccan_list_check(ref(&parent.children, parent_count), NULL));
if (i > 2)
break;
}
ok1(i == 3);
ok1(parent_count == 19);
- ok1(list_empty(ref(&parent.children, parent_count)));
+ ok1(ccan_list_empty(ref(&parent.children, parent_count)));
ok1(parent_count == 20);
- /* Test list_top/list_tail on empty list. */
- ok1(list_top(ref(&parent.children, parent_count), struct child, list) == NULL);
+ /* Test ccan_list_top/ccan_list_tail on empty list. */
+ ok1(ccan_list_top(ref(&parent.children, parent_count), struct child, list) == NULL);
ok1(parent_count == 21);
- ok1(list_tail(ref(&parent.children, parent_count), struct child, list) == NULL);
+ ok1(ccan_list_tail(ref(&parent.children, parent_count), struct child, list) == NULL);
ok1(parent_count == 22);
return exit_status();
}
diff --git a/lib/ccan/list/test/run.c b/lib/ccan/list/test/run.c
index 952a0e15e6..a93234d655 100644
--- a/lib/ccan/list/test/run.c
+++ b/lib/ccan/list/test/run.c
@@ -5,67 +5,67 @@
struct parent {
const char *name;
- struct list_head children;
+ struct ccan_list_head children;
unsigned int num_children;
};
struct child {
const char *name;
- struct list_node list;
+ struct ccan_list_node list;
};
-static LIST_HEAD(static_list);
+static CCAN_LIST_HEAD(static_list);
int main(int argc, char *argv[])
{
struct parent parent;
struct child c1, c2, c3, *c, *n;
unsigned int i;
- struct list_head list = LIST_HEAD_INIT(list);
+ struct ccan_list_head list = CCAN_LIST_HEAD_INIT(list);
opaque_t *q, *nq;
- struct list_head opaque_list = LIST_HEAD_INIT(opaque_list);
+ struct ccan_list_head opaque_list = CCAN_LIST_HEAD_INIT(opaque_list);
plan_tests(65);
- /* Test LIST_HEAD, LIST_HEAD_INIT, list_empty and check_list */
- ok1(list_empty(&static_list));
- ok1(list_check(&static_list, NULL));
- ok1(list_empty(&list));
- ok1(list_check(&list, NULL));
+ /* Test CCAN_LIST_HEAD, CCAN_LIST_HEAD_INIT, ccan_list_empty and check_list */
+ ok1(ccan_list_empty(&static_list));
+ ok1(ccan_list_check(&static_list, NULL));
+ ok1(ccan_list_empty(&list));
+ ok1(ccan_list_check(&list, NULL));
parent.num_children = 0;
- list_head_init(&parent.children);
- /* Test list_head_init */
- ok1(list_empty(&parent.children));
- ok1(list_check(&parent.children, NULL));
+ ccan_list_head_init(&parent.children);
+ /* Test ccan_list_head_init */
+ ok1(ccan_list_empty(&parent.children));
+ ok1(ccan_list_check(&parent.children, NULL));
c2.name = "c2";
- list_add(&parent.children, &c2.list);
- /* Test list_add and !list_empty. */
- ok1(!list_empty(&parent.children));
+ ccan_list_add(&parent.children, &c2.list);
+ /* Test ccan_list_add and !ccan_list_empty. */
+ ok1(!ccan_list_empty(&parent.children));
ok1(c2.list.next == &parent.children.n);
ok1(c2.list.prev == &parent.children.n);
ok1(parent.children.n.next == &c2.list);
ok1(parent.children.n.prev == &c2.list);
- /* Test list_check */
- ok1(list_check(&parent.children, NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(&parent.children, NULL));
c1.name = "c1";
- list_add(&parent.children, &c1.list);
- /* Test list_add and !list_empty. */
- ok1(!list_empty(&parent.children));
+ ccan_list_add(&parent.children, &c1.list);
+ /* Test ccan_list_add and !ccan_list_empty. */
+ ok1(!ccan_list_empty(&parent.children));
ok1(c2.list.next == &parent.children.n);
ok1(c2.list.prev == &c1.list);
ok1(parent.children.n.next == &c1.list);
ok1(parent.children.n.prev == &c2.list);
ok1(c1.list.next == &c2.list);
ok1(c1.list.prev == &parent.children.n);
- /* Test list_check */
- ok1(list_check(&parent.children, NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(&parent.children, NULL));
c3.name = "c3";
- list_add_tail(&parent.children, &c3.list);
- /* Test list_add_tail and !list_empty. */
- ok1(!list_empty(&parent.children));
+ ccan_list_add_tail(&parent.children, &c3.list);
+ /* Test ccan_list_add_tail and !ccan_list_empty. */
+ ok1(!ccan_list_empty(&parent.children));
ok1(parent.children.n.next == &c1.list);
ok1(parent.children.n.prev == &c3.list);
ok1(c1.list.next == &c2.list);
@@ -74,23 +74,23 @@ int main(int argc, char *argv[])
ok1(c2.list.prev == &c1.list);
ok1(c3.list.next == &parent.children.n);
ok1(c3.list.prev == &c2.list);
- /* Test list_check */
- ok1(list_check(&parent.children, NULL));
+ /* Test ccan_list_check */
+ ok1(ccan_list_check(&parent.children, NULL));
- /* Test list_check_node */
- ok1(list_check_node(&c1.list, NULL));
- ok1(list_check_node(&c2.list, NULL));
- ok1(list_check_node(&c3.list, NULL));
+ /* Test ccan_list_check_node */
+ ok1(ccan_list_check_node(&c1.list, NULL));
+ ok1(ccan_list_check_node(&c2.list, NULL));
+ ok1(ccan_list_check_node(&c3.list, NULL));
- /* Test list_top */
- ok1(list_top(&parent.children, struct child, list) == &c1);
+ /* Test ccan_list_top */
+ ok1(ccan_list_top(&parent.children, struct child, list) == &c1);
- /* Test list_tail */
- ok1(list_tail(&parent.children, struct child, list) == &c3);
+ /* Test ccan_list_tail */
+ ok1(ccan_list_tail(&parent.children, struct child, list) == &c3);
- /* Test list_for_each. */
+ /* Test ccan_list_for_each. */
i = 0;
- list_for_each(&parent.children, c, list) {
+ ccan_list_for_each(&parent.children, c, list) {
switch (i++) {
case 0:
ok1(c == &c1);
@@ -107,9 +107,9 @@ int main(int argc, char *argv[])
}
ok1(i == 3);
- /* Test list_for_each_rev. */
+ /* Test ccan_list_for_each_rev. */
i = 0;
- list_for_each_rev(&parent.children, c, list) {
+ ccan_list_for_each_rev(&parent.children, c, list) {
switch (i++) {
case 0:
ok1(c == &c3);
@@ -126,75 +126,75 @@ int main(int argc, char *argv[])
}
ok1(i == 3);
- /* Test list_for_each_safe, list_del and list_del_from. */
+ /* Test ccan_list_for_each_safe, ccan_list_del and ccan_list_del_from. */
i = 0;
- list_for_each_safe(&parent.children, c, n, list) {
+ ccan_list_for_each_safe(&parent.children, c, n, list) {
switch (i++) {
case 0:
ok1(c == &c1);
- list_del(&c->list);
+ ccan_list_del(&c->list);
break;
case 1:
ok1(c == &c2);
- list_del_from(&parent.children, &c->list);
+ ccan_list_del_from(&parent.children, &c->list);
break;
case 2:
ok1(c == &c3);
- list_del_from(&parent.children, &c->list);
+ ccan_list_del_from(&parent.children, &c->list);
break;
}
- ok1(list_check(&parent.children, NULL));
+ ok1(ccan_list_check(&parent.children, NULL));
if (i > 2)
break;
}
ok1(i == 3);
- ok1(list_empty(&parent.children));
+ ok1(ccan_list_empty(&parent.children));
- /* Test list_for_each_off. */
- list_add_tail(&opaque_list,
- (struct list_node *)create_opaque_blob());
- list_add_tail(&opaque_list,
- (struct list_node *)create_opaque_blob());
- list_add_tail(&opaque_list,
- (struct list_node *)create_opaque_blob());
+ /* Test ccan_list_for_each_off. */
+ ccan_list_add_tail(&opaque_list,
+ (struct ccan_list_node *)create_opaque_blob());
+ ccan_list_add_tail(&opaque_list,
+ (struct ccan_list_node *)create_opaque_blob());
+ ccan_list_add_tail(&opaque_list,
+ (struct ccan_list_node *)create_opaque_blob());
i = 0;
- list_for_each_off(&opaque_list, q, 0) {
+ ccan_list_for_each_off(&opaque_list, q, 0) {
i++;
ok1(if_blobs_know_the_secret(q));
}
ok1(i == 3);
- /* Test list_for_each_safe_off, list_del_off and list_del_from_off. */
+ /* Test ccan_list_for_each_safe_off, ccan_list_del_off and ccan_list_del_from_off. */
i = 0;
- list_for_each_safe_off(&opaque_list, q, nq, 0) {
+ ccan_list_for_each_safe_off(&opaque_list, q, nq, 0) {
switch (i++) {
case 0:
ok1(if_blobs_know_the_secret(q));
- list_del_off(q, 0);
+ ccan_list_del_off(q, 0);
destroy_opaque_blob(q);
break;
case 1:
ok1(if_blobs_know_the_secret(q));
- list_del_from_off(&opaque_list, q, 0);
+ ccan_list_del_from_off(&opaque_list, q, 0);
destroy_opaque_blob(q);
break;
case 2:
ok1(c == &c3);
- list_del_from_off(&opaque_list, q, 0);
+ ccan_list_del_from_off(&opaque_list, q, 0);
destroy_opaque_blob(q);
break;
}
- ok1(list_check(&opaque_list, NULL));
+ ok1(ccan_list_check(&opaque_list, NULL));
if (i > 2)
break;
}
ok1(i == 3);
- ok1(list_empty(&opaque_list));
+ ok1(ccan_list_empty(&opaque_list));
- /* 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);
+ /* Test ccan_list_top/ccan_list_tail on empty list. */
+ ok1(ccan_list_top(&parent.children, struct child, list) == NULL);
+ ok1(ccan_list_tail(&parent.children, struct child, list) == NULL);
return exit_status();
}