add depth assertion to basic tree iterator test

Mon, 19 Feb 2024 22:12:13 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 19 Feb 2024 22:12:13 +0100
changeset 837
7c15fea5cbea
parent 836
2672a2f79484
child 838
1ce90ab4fab9

add depth assertion to basic tree iterator test

tests/test_tree.c file | annotate | diff | comparison | revisions
--- a/tests/test_tree.c	Mon Feb 19 22:09:16 2024 +0100
+++ b/tests/test_tree.c	Mon Feb 19 22:12:13 2024 +0100
@@ -303,6 +303,15 @@
             chk++;
             CX_TEST_ASSERT(node == iter.node);
             CX_TEST_ASSERT(!iter.exiting);
+            if (node == &root) {
+                CX_TEST_ASSERT(iter.depth == 1);
+            } else if (node == &a || node == &b || node == &c) {
+                CX_TEST_ASSERT(iter.depth == 2);
+            } else if (node == &cba) {
+                CX_TEST_ASSERT(iter.depth == 4);
+            } else {
+                CX_TEST_ASSERT(iter.depth == 3);
+            }
         }
         CX_TEST_ASSERT(iter.counter == 11);
         CX_TEST_ASSERT(chk == 11);

mercurial