Mon, 19 Feb 2024 22:12:13 +0100
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);