chiark / gitweb /
test: duplicate LIST_FOREACH_OTHERS test to check for corner cases of end and start...
[elogind.git] / src / test / test-list.c
index 399ec8e58e01375fd363180ab9824de46160744a..f6da1a70533ad8a53a09b38b4901a13f1006ba8d 100644 (file)
@@ -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);