diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-01-28 14:22:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-01-28 14:22:13 +0100 |
commit | 3ad85e3775d018f32098a2957ce25e1f53440da1 (patch) | |
tree | 13555c1700ee782e51462f8f5a339dbb8b6a4332 | |
parent | cdda4aa8d20c2679cc937d40e793abe7806f17cb (diff) |
test: duplicate LIST_FOREACH_OTHERS test to check for corner cases of end and start of list
-rw-r--r-- | src/test/test-list.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-list.c b/src/test/test-list.c index 399ec8e58e..f6da1a7053 100644 --- a/src/test/test-list.c +++ b/src/test/test-list.c @@ -45,6 +45,20 @@ int main(int argc, const char *argv[]) { } assert_se(i == ELEMENTSOF(items)-1); + i = 0; + LIST_FOREACH_OTHERS(item, cursor, &items[0]) { + i++; + assert_se(cursor != &items[0]); + } + assert_se(i == ELEMENTSOF(items)-1); + + i = 0; + LIST_FOREACH_OTHERS(item, cursor, &items[3]) { + i++; + assert_se(cursor != &items[3]); + } + assert_se(i == ELEMENTSOF(items)-1); + assert_se(!LIST_JUST_US(item, head)); assert_se(items[0].item_next == NULL); |