summaryrefslogtreecommitdiff
path: root/test/test_rdxtree.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-06-07 21:10:38 +0200
committerRichard Braun <rbraun@sceen.net>2013-06-07 21:10:38 +0200
commitccb0cb9f1cd421e3115fbd6f21ee471b60a3b222 (patch)
tree2b375e71afe7f593881b18165b77f45d82550f60 /test/test_rdxtree.c
parent5cd31ea331734d0d756f6b54060dadaa010a9b92 (diff)
test_rdxtree: test insert with allocation and slot
Diffstat (limited to 'test/test_rdxtree.c')
-rw-r--r--test/test_rdxtree.c25
1 files changed, 25 insertions, 0 deletions
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;
}