Lines Matching refs:tree
47 tree_t tree; in TEST_BEGIN() local
50 tree_new(&tree); in TEST_BEGIN()
52 assert_true(tree_empty(&tree), "Tree should be empty"); in TEST_BEGIN()
53 assert_ptr_null(tree_first(&tree), "Unexpected node"); in TEST_BEGIN()
54 assert_ptr_null(tree_last(&tree), "Unexpected node"); in TEST_BEGIN()
58 assert_ptr_null(tree_search(&tree, &key), "Unexpected node"); in TEST_BEGIN()
62 assert_ptr_null(tree_nsearch(&tree, &key), "Unexpected node"); in TEST_BEGIN()
66 assert_ptr_null(tree_psearch(&tree, &key), "Unexpected node"); in TEST_BEGIN()
115 tree_iterate_cb(tree_t *tree, node_t *node, void *data) in tree_iterate_cb() argument
123 search_node = tree_search(tree, node); in tree_iterate_cb()
128 search_node = tree_nsearch(tree, node); in tree_iterate_cb()
133 search_node = tree_psearch(tree, node); in tree_iterate_cb()
143 tree_iterate(tree_t *tree) in tree_iterate() argument
148 tree_iter(tree, NULL, tree_iterate_cb, (void *)&i); in tree_iterate()
154 tree_iterate_reverse(tree_t *tree) in tree_iterate_reverse() argument
159 tree_reverse_iter(tree, NULL, tree_iterate_cb, (void *)&i); in tree_iterate_reverse()
165 node_remove(tree_t *tree, node_t *node, unsigned nnodes) in node_remove() argument
170 tree_remove(tree, node); in node_remove()
173 search_node = tree_nsearch(tree, node); in node_remove()
180 search_node = tree_psearch(tree, node); in node_remove()
188 rbtn_black_height(node_t, link, tree, black_height); in node_remove()
189 imbalances = tree_recurse(tree->rbt_root, black_height, 0); in node_remove()
191 assert_u_eq(tree_iterate(tree), nnodes-1, in node_remove()
193 assert_u_eq(tree_iterate_reverse(tree), nnodes-1, in node_remove()
198 remove_iterate_cb(tree_t *tree, node_t *node, void *data) in remove_iterate_cb() argument
201 node_t *ret = tree_next(tree, node); in remove_iterate_cb()
203 node_remove(tree, node, *nnodes); in remove_iterate_cb()
209 remove_reverse_iterate_cb(tree_t *tree, node_t *node, void *data) in remove_reverse_iterate_cb() argument
212 node_t *ret = tree_prev(tree, node); in remove_reverse_iterate_cb()
214 node_remove(tree, node, *nnodes); in remove_reverse_iterate_cb()
235 tree_t tree; in TEST_BEGIN() local
259 tree_new(&tree); in TEST_BEGIN()
267 tree_insert(&tree, &nodes[k]); in TEST_BEGIN()
269 rbtn_black_height(node_t, link, &tree, in TEST_BEGIN()
271 imbalances = tree_recurse(tree.rbt_root, in TEST_BEGIN()
276 assert_u_eq(tree_iterate(&tree), k+1, in TEST_BEGIN()
278 assert_u_eq(tree_iterate_reverse(&tree), k+1, in TEST_BEGIN()
281 assert_false(tree_empty(&tree), in TEST_BEGIN()
283 assert_ptr_not_null(tree_first(&tree), in TEST_BEGIN()
285 assert_ptr_not_null(tree_last(&tree), in TEST_BEGIN()
288 tree_next(&tree, &nodes[k]); in TEST_BEGIN()
289 tree_prev(&tree, &nodes[k]); in TEST_BEGIN()
296 node_remove(&tree, &nodes[k], j - k); in TEST_BEGIN()
300 node_remove(&tree, &nodes[k-1], k); in TEST_BEGIN()
308 start = tree_iter(&tree, start, in TEST_BEGIN()
321 start = tree_reverse_iter(&tree, start, in TEST_BEGIN()
331 tree_destroy(&tree, destroy_cb, &nnodes); in TEST_BEGIN()