summaryrefslogtreecommitdiff
path: root/src/test/test-list.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-09 13:34:01 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 18:17:33 -0500
commit502f1733e320b1339beafa949a41db3027c46ec6 (patch)
treef74b79b7e9d344a5ba2a35d95f209a9cb08c1327 /src/test/test-list.c
parent33e1e5a756300e29c74fdc59ea762f9394df8368 (diff)
shared/list: add LIST_APPEND
Diffstat (limited to 'src/test/test-list.c')
-rw-r--r--src/test/test-list.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/test-list.c b/src/test/test-list.c
index fa52ad1db..e9d47f050 100644
--- a/src/test/test-list.c
+++ b/src/test/test-list.c
@@ -105,5 +105,29 @@ int main(int argc, const char *argv[]) {
LIST_REMOVE(item, head, &items[3]);
assert_se(LIST_JUST_US(item, &items[3]));
+ assert_se(head == NULL);
+
+ for (i = 0; i < ELEMENTSOF(items); i++) {
+ assert_se(LIST_JUST_US(item, &items[i]));
+ LIST_APPEND(item, head, &items[i]);
+ }
+
+ assert_se(!LIST_JUST_US(item, head));
+
+ assert_se(items[0].item_next == &items[1]);
+ assert_se(items[1].item_next == &items[2]);
+ assert_se(items[2].item_next == &items[3]);
+ assert_se(items[3].item_next == NULL);
+
+ assert_se(items[0].item_prev == NULL);
+ assert_se(items[1].item_prev == &items[0]);
+ assert_se(items[2].item_prev == &items[1]);
+ assert_se(items[3].item_prev == &items[2]);
+
+ for (i = 0; i < ELEMENTSOF(items); i++)
+ LIST_REMOVE(item, head, &items[i]);
+
+ assert_se(head == NULL);
+
return 0;
}