diff options
author | Richard Braun <rbraun@sceen.net> | 2013-06-07 20:44:19 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-06-07 20:44:19 +0200 |
commit | 817f3a0d5b633e06b2b6853b6f91d4439e4304f0 (patch) | |
tree | 8be68474842743d2e8eed97bf05a2fccebf0cbce /test | |
parent | 425c30d6b816aef9467252aa212474acd7be54fb (diff) |
test_rdxtree: test insertion on busy key
Diffstat (limited to 'test')
-rw-r--r-- | test/test_rdxtree.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_rdxtree.c b/test/test_rdxtree.c index be375bf..ecefbcb 100644 --- a/test/test_rdxtree.c +++ b/test/test_rdxtree.c @@ -27,6 +27,7 @@ #include <assert.h> #include <stdarg.h> +#include "../error.h" #include "../macros.h" #include "../rdxtree.c" @@ -623,6 +624,42 @@ test_20(void) destroy_tree(&tree); } +static void +test_21(void) +{ + struct rdxtree tree; + struct obj *obj; + int error; + + TITLE("insert 0, insert again"); + + rdxtree_init(&tree); + obj = obj_create(0); + error = rdxtree_insert(&tree, 0, obj); + assert(!error); + error = rdxtree_insert(&tree, 0, obj); + assert(error == ERR_BUSY); + destroy_tree(&tree); +} + +static void +test_22(void) +{ + struct rdxtree tree; + struct obj *obj; + int error; + + TITLE("insert 123, insert again"); + + rdxtree_init(&tree); + obj = obj_create(123); + error = rdxtree_insert(&tree, 123, obj); + assert(!error); + error = rdxtree_insert(&tree, 123, obj); + assert(error == ERR_BUSY); + destroy_tree(&tree); +} + int main(int argc, char *argv[]) { @@ -649,5 +686,7 @@ main(int argc, char *argv[]) test_18(); test_19(); test_20(); + test_21(); + test_22(); return 0; } |