tests/test_tree.c

changeset 985
68754c7de906
parent 931
be71809e69d1
equal deleted inserted replaced
984:e8f354a25ac8 985:68754c7de906
1955 cx_testing_allocator_destroy(&talloc); 1955 cx_testing_allocator_destroy(&talloc);
1956 } 1956 }
1957 1957
1958 static void test_tree_remove_node_relink_mock( 1958 static void test_tree_remove_node_relink_mock(
1959 void *node, 1959 void *node,
1960 __attribute__((__unused__)) const void *oldp, 1960 cx_attr_unused const void *oldp,
1961 __attribute__((__unused__)) const void *newp 1961 cx_attr_unused const void *newp
1962 ) { 1962 ) {
1963 tree_node_file * n = node; 1963 tree_node_file * n = node;
1964 // this function fakes the relink logic in below test 1964 // this function fakes the relink logic in below test
1965 if (strcmp(n->path, "/usr/share/") == 0) { 1965 if (strcmp(n->path, "/usr/share/") == 0) {
1966 n->path = "/share/"; 1966 n->path = "/share/";
2173 CxTree *w = cxTreeCreateWrapped(alloc, root, tree_node_file_layout); 2173 CxTree *w = cxTreeCreateWrapped(alloc, root, tree_node_file_layout);
2174 w->advanced_destructor = (cx_destructor_func2) cxFree; 2174 w->advanced_destructor = (cx_destructor_func2) cxFree;
2175 w->destructor_data = alloc; 2175 w->destructor_data = alloc;
2176 cxTreeDestroySubtree(w, w->root); 2176 cxTreeDestroySubtree(w, w->root);
2177 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc)); 2177 CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
2178 cxFree(alloc, w); 2178 cxTreeDestroy(w);
2179 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); 2179 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
2180 } 2180 }
2181 cx_testing_allocator_destroy(&talloc); 2181 cx_testing_allocator_destroy(&talloc);
2182 } 2182 }
2183 2183

mercurial