diff --git a/tests/bench.h b/tests/bench.h index 3f8133b..27dd975 100644 --- a/tests/bench.h +++ b/tests/bench.h @@ -25,7 +25,6 @@ typedef struct { #define BENCHMARK(name) \ - { \ bench B; B.N = 5000000; B.R = 3; \ bench_start(&B); \ for (int _r = 0; _r < B.R ; _r++ ) { \ @@ -34,8 +33,7 @@ typedef struct { #define END_BENCHMARK() \ } \ } \ - bench_stop(&B); \ - } + bench_stop(&B); diff --git a/tests/check_tree.c b/tests/check_tree.c index c3e92c1..806110c 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -262,6 +262,9 @@ START_TEST(benchmark_str) match_entry * entry = calloc( sizeof(entry) , 1 ); node * n = r3_tree_create(1); + + int route_data = 999; + r3_tree_insert_path(n, "/foo/bar/baz", NULL); r3_tree_insert_path(n, "/foo/bar/qux", NULL); r3_tree_insert_path(n, "/foo/bar/quux", NULL); @@ -397,7 +400,7 @@ START_TEST(benchmark_str) r3_tree_insert_path(n, "/qux/bar/foo", NULL); r3_tree_insert_path(n, "/qux/bar/baz", NULL); r3_tree_insert_path(n, "/qux/bar/quux", NULL); - r3_tree_insert_path(n, "/qux/bar/corge", (void*) 999); + r3_tree_insert_path(n, "/qux/bar/corge", (void*) &route_data); r3_tree_insert_path(n, "/qux/bar/grault", NULL); r3_tree_insert_path(n, "/qux/bar/garply", NULL); r3_tree_insert_path(n, "/qux/baz/foo", NULL); @@ -607,7 +610,7 @@ START_TEST(benchmark_str) m = r3_tree_match(n , "/qux/bar/corge", strlen("/qux/bar/corge"), NULL); fail_if( m == NULL ); // r3_tree_dump( m, 0 ); - ck_assert_int_eq( (int) m->route_ptr, 999 ); + ck_assert_int_eq( *((int*) m->route_ptr), 999 ); printf("Benchmarking...\n");