From ccb0cb9f1cd421e3115fbd6f21ee471b60a3b222 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 7 Jun 2013 21:10:38 +0200 Subject: test_rdxtree: test insert with allocation and slot --- test/test_rdxtree.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/test_rdxtree.c') diff --git a/test/test_rdxtree.c b/test/test_rdxtree.c index bfe7b43..c7de812 100644 --- a/test/test_rdxtree.c +++ b/test/test_rdxtree.c @@ -696,6 +696,30 @@ test_24(void) destroy_tree(&tree); } +static void +test_25(void) +{ + struct rdxtree tree; + struct obj *obj; + void **slot; + unsigned long i; + int error; + + TITLE("insert_alloc_slot x3"); + + rdxtree_init(&tree); + + for (i = 0; i < 3; i++) { + obj = obj_create(0); + error = rdxtree_insert_alloc_slot(&tree, obj, &obj->id, &slot); + assert(!error); + assert(obj->id == i); + assert(*slot == obj); + } + + destroy_tree(&tree); +} + int main(int argc, char *argv[]) { @@ -726,5 +750,6 @@ main(int argc, char *argv[]) test_22(); test_23(); test_24(); + test_25(); return 0; } -- cgit v1.2.3