tests/test_tree.c

changeset 908
f49f8a7060aa
parent 907
1f72fb9af87e
child 909
f4e00bb3f3b2
equal deleted inserted replaced
907:1f72fb9af87e 908:f49f8a7060aa
1766 tree_node_file *share = cxCalloc(alloc, 1, sizeof(tree_node_file)); 1766 tree_node_file *share = cxCalloc(alloc, 1, sizeof(tree_node_file));
1767 share->path = "/usr/share/"; 1767 share->path = "/usr/share/";
1768 cxTreeAddChildNode(tree, cxTreeFind(tree, "/usr/"), share); 1768 cxTreeAddChildNode(tree, cxTreeFind(tree, "/usr/"), share);
1769 CX_TEST_ASSERT(tree->size == 8); 1769 CX_TEST_ASSERT(tree->size == 8);
1770 1770
1771 cxTreeRemove(tree, foo); 1771 cxTreeRemoveSubtree(tree, foo);
1772 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/foo/")); 1772 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/foo/"));
1773 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/foo/bar/")); 1773 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/foo/bar/"));
1774 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/bar/")); 1774 CX_TEST_ASSERT(NULL == cxTreeFind(tree, "/home/bar/"));
1775 CX_TEST_ASSERT(tree->size == 6); 1775 CX_TEST_ASSERT(tree->size == 6);
1776 1776
1809 "/home/foo/", 1809 "/home/foo/",
1810 "/home/foo/bar/" 1810 "/home/foo/bar/"
1811 }; 1811 };
1812 cxTreeInsertArray(tree, paths, sizeof(const char*), 6); 1812 cxTreeInsertArray(tree, paths, sizeof(const char*), 6);
1813 void *root = tree->root; 1813 void *root = tree->root;
1814 cxTreeRemove(tree, root); 1814 cxTreeRemoveSubtree(tree, root);
1815 CX_TEST_ASSERT(tree->size == 0); 1815 CX_TEST_ASSERT(tree->size == 0);
1816 CX_TEST_ASSERT(tree->root == NULL); 1816 CX_TEST_ASSERT(tree->root == NULL);
1817 CX_TEST_ASSERT(cxTreeDepth(tree) == 0); 1817 CX_TEST_ASSERT(cxTreeDepth(tree) == 0);
1818 cxTreeDestroy(tree); 1818 cxTreeDestroy(tree);
1819 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc)); 1819 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));

mercurial