From de8c26a11a80d79015eccc0cf715f52b977159ec Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 20 May 2014 16:18:17 +0800 Subject: [PATCH] fix tests --- tests/bench_str.csv | 28 ++++++++++++++++++++++++++++ tests/check_tree.c | 13 ++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/tests/bench_str.csv b/tests/bench_str.csv index e69f128..7182960 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -330,3 +330,31 @@ 1400467139,13047096.38 1400467481,13594764.91 1400468648,13474532.60 +1400570358,16277787.44 +1400570442,16505301.07 +1400570494,16651367.19 +1400570540,16509970.21 +1400571025,16271291.64 +1400571045,16347991.85 +1400571109,16051262.35 +1400571116,16000716.18 +1400571171,15655022.26 +1400571314,15695138.73 +1400571328,15779592.30 +1400571446,16173358.85 +1400571511,15816846.60 +1400571580,15165532.41 +1400571819,15473025.62 +1400571872,14901576.43 +1400571879,14751988.30 +1400571889,15028402.84 +1400571925,13450622.41 +1400571993,13276463.85 +1400572069,13113355.08 +1400572160,13281786.31 +1400573791,13580509.03 +1400573832,10555723.33 +1400573839,10582884.42 +1400573847,10478482.69 +1400573855,15087645.17 +1400573891,15207920.79 diff --git a/tests/check_tree.c b/tests/check_tree.c index 55fdb70..bc061c1 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -17,16 +17,12 @@ START_TEST (test_ltrim_slash) } END_TEST -START_TEST (test_r3_node_construct_uniq) +START_TEST (test_r3_node_construct_and_free) { node * n = r3_tree_create(10); - node * child = r3_tree_create(3); - - // fail_if( r3_node_add_child(n, strdup("/add") , child) != NULL ); - // fail_if( r3_node_add_child(n, strdup("/add") , child) != NULL ); - r3_tree_free(n); + r3_tree_free(child); } END_TEST @@ -282,6 +278,7 @@ START_TEST(test_pcre_pattern_simple) fail_if(matched == NULL); ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); + r3_tree_free(n); } END_TEST @@ -330,6 +327,8 @@ START_TEST(test_pcre_pattern_more) ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); ck_assert_int_eq( *((int*)matched->data), var3); + + r3_tree_free(n); } END_TEST @@ -739,9 +738,9 @@ Suite* r3_suite (void) { Suite *suite = suite_create("blah"); TCase *tcase = tcase_create("testcase"); + tcase_add_test(tcase, test_r3_node_construct_and_free); tcase_add_test(tcase, test_str_array); tcase_add_test(tcase, test_ltrim_slash); - tcase_add_test(tcase, test_r3_node_construct_uniq); tcase_add_test(tcase, test_r3_node_find_edge); tcase_add_test(tcase, test_r3_tree_insert_pathl); tcase_add_test(tcase, test_compile_slug);