From 05b698b841c31c3e2cd7379d64ade3618295438e Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 21 May 2014 18:31:51 +0800 Subject: [PATCH] r3_tree_matchl does not return int --- tests/bench_str.csv | 1 + tests/check_tree.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/bench_str.csv b/tests/bench_str.csv index 12a32f5..6a7117a 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -445,3 +445,4 @@ 1400666950,6684744.95 1400667091,6771202.47 1400667800,6695271.95 +1400668268,13174604.57 diff --git a/tests/check_tree.c b/tests/check_tree.c index 88904f1..72af3e1 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -72,27 +72,27 @@ START_TEST (test_compile) entry = match_entry_createl( "foo" , strlen("/foo") ); m = r3_tree_matchl( n , "/foo", strlen("/foo"), entry); - ck_assert( (int)m ); + ck_assert( m ); entry = match_entry_createl( "/zoo" , strlen("/zoo") ); m = r3_tree_matchl( n , "/zoo", strlen("/zoo"), entry); - ck_assert( (int)m ); + ck_assert( m ); entry = match_entry_createl( "/bar" , strlen("/bar") ); m = r3_tree_matchl( n , "/bar", strlen("/bar"), entry); - ck_assert( (int)m ); + ck_assert( m ); entry = match_entry_createl( "/xxx" , strlen("/xxx") ); m = r3_tree_matchl( n , "/xxx", strlen("/xxx"), entry); - ck_assert( (int)m ); + ck_assert( m ); entry = match_entry_createl( "/foo/xxx" , strlen("/foo/xxx") ); m = r3_tree_matchl( n , "/foo/xxx", strlen("/foo/xxx"), entry); - ck_assert( (int)m ); + ck_assert( m ); entry = match_entry_createl( "/some_id" , strlen("/some_id") ); m = r3_tree_matchl( n , "/some_id", strlen("/some_id"), entry); - ck_assert( (int)m ); + ck_assert( m ); } END_TEST @@ -107,7 +107,7 @@ START_TEST (test_pcre_patterns_insert) node *matched; matched = r3_tree_matchl(n, "/post/111-222", strlen("/post/111-222"), NULL); - ck_assert((int)matched); + ck_assert(matched); ck_assert(matched->endpoint > 0); // incomplete string shouldn't match @@ -273,7 +273,7 @@ START_TEST(test_pcre_pattern_simple) // r3_tree_dump(n, 0); node *matched; matched = r3_tree_matchl(n, "/user/123", strlen("/user/123"), entry); - fail_if(matched == NULL); + ck_assert(matched); ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); r3_tree_free(n); @@ -306,7 +306,7 @@ START_TEST(test_pcre_pattern_more) node *matched; matched = r3_tree_matchl(n, "/user/123", strlen("/user/123"), entry); - fail_if(matched == NULL); + ck_assert(matched); ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); @@ -315,13 +315,13 @@ START_TEST(test_pcre_pattern_more) ck_assert_int_eq( *((int*) matched->data), var1); matched = r3_tree_matchl(n, "/user2/123", strlen("/user2/123"), entry); - fail_if(matched == NULL); + ck_assert(matched); ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); ck_assert_int_eq( *((int*)matched->data), var2); matched = r3_tree_matchl(n, "/user3/123", strlen("/user3/123"), entry); - fail_if(matched == NULL); + ck_assert(matched); ck_assert(entry->vars->len > 0); ck_assert_str_eq(entry->vars->tokens[0],"123"); ck_assert_int_eq( *((int*)matched->data), var3);