tests/test_tree.c

changeset 833
5c926801f052
parent 826
21840975d541
child 836
2672a2f79484
equal deleted inserted replaced
832:97df2e4c68fb 833:5c926801f052
248 CX_TEST_ASSERT(r > 0); 248 CX_TEST_ASSERT(r > 0);
249 CX_TEST_ASSERT(n == &cc); 249 CX_TEST_ASSERT(n == &cc);
250 } 250 }
251 } 251 }
252 252
253 CX_TEST(test_tree_iterator_create) {
254 tree_node root;
255 CX_TEST_DO {
256 CxTreeIterator iter = cx_tree_iterator(&root, false, tree_child_list);
257 CX_TEST_ASSERT(!iter.visit_on_exit);
258 CX_TEST_ASSERT(!iter.exiting);
259 CX_TEST_ASSERT(iter.counter == 1);
260 CX_TEST_ASSERT(iter.node == &root);
261 CX_TEST_ASSERT(!iter.base.mutating);
262 CX_TEST_ASSERT(!iter.base.remove);
263 CX_TEST_ASSERT(iter.stack != NULL);
264 CX_TEST_ASSERT(iter.stack_capacity > 0);
265 CX_TEST_ASSERT(iter.stack_size == 1);
266 CX_TEST_ASSERT(iter.depth == 1);
267 CX_TEST_ASSERT(iter.loc_next == offsetof(tree_node, next));
268 CX_TEST_ASSERT(iter.loc_children == offsetof(tree_node, children));
269 }
270 }
271
253 CxTestSuite *cx_test_suite_tree_low_level(void) { 272 CxTestSuite *cx_test_suite_tree_low_level(void) {
254 CxTestSuite *suite = cx_test_suite_new("tree (low level)"); 273 CxTestSuite *suite = cx_test_suite_new("tree (low level)");
255 274
256 cx_test_register(suite, test_tree_link_new_child); 275 cx_test_register(suite, test_tree_link_new_child);
257 cx_test_register(suite, test_tree_link_add_child); 276 cx_test_register(suite, test_tree_link_add_child);
258 cx_test_register(suite, test_tree_link_move_to_other_parent); 277 cx_test_register(suite, test_tree_link_move_to_other_parent);
259 cx_test_register(suite, test_tree_unlink); 278 cx_test_register(suite, test_tree_unlink);
260 cx_test_register(suite, test_tree_search); 279 cx_test_register(suite, test_tree_search);
280 cx_test_register(suite, test_tree_iterator_create);
261 281
262 return suite; 282 return suite;
263 } 283 }

mercurial