summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-28 00:34:58 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-28 00:34:58 +0100
commit7663df377016cf7b95001aec893006647175ae4a (patch)
tree523a2d1bf1787b9a3b08ae516cd54c9a022f9b73 /src/test
parent976dec6e7b2d193533191be2969dd4eee95fc6bb (diff)
list: add macro for iterating through a list an item is in, skipping the item
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-list.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/test-list.c b/src/test/test-list.c
index e9d47f0503..399ec8e58e 100644
--- a/src/test/test-list.c
+++ b/src/test/test-list.c
@@ -38,6 +38,13 @@ int main(int argc, const char *argv[]) {
LIST_PREPEND(item, head, &items[i]);
}
+ i = 0;
+ LIST_FOREACH_OTHERS(item, cursor, &items[2]) {
+ i++;
+ assert_se(cursor != &items[2]);
+ }
+ assert_se(i == ELEMENTSOF(items)-1);
+
assert_se(!LIST_JUST_US(item, head));
assert_se(items[0].item_next == NULL);
@@ -125,7 +132,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[3].item_prev == &items[2]);
for (i = 0; i < ELEMENTSOF(items); i++)
- LIST_REMOVE(item, head, &items[i]);
+ LIST_REMOVE(item, head, &items[i]);
assert_se(head == NULL);