more test case

This commit is contained in:
c9s 2014-05-21 00:49:08 +08:00
parent 5bd1757e5f
commit aae35c3b90
2 changed files with 14 additions and 5 deletions

View file

@ -398,3 +398,6 @@
1400603800,13715365.00
1400603827,12742770.05
1400604427,13725403.62
1400604504,13787120.46
1400604527,13505264.87
1400604546,13522321.17

1 1400242718 5649455.80
398 1400603800 13715365.00
399 1400603827 12742770.05
400 1400604427 13725403.62
401 1400604504 13787120.46
402 1400604527 13505264.87
403 1400604546 13522321.17

View file

@ -138,18 +138,23 @@ START_TEST (test_pcre_patterns_insert_2)
END_TEST
/**
* Test for \d{3}-\d{4}
* Test for \d{2}-\d{2}
*/
START_TEST (test_pcre_patterns_insert_3)
{
node * n = r3_tree_create(10);
r3_tree_insert_path(n, "/post/{idx:\\d{2}}/{idy:\\d{2}}", NULL);
r3_tree_insert_path(n, "/post/{idx:\\d{2}}/{idy}", NULL);
r3_tree_compile(n);
r3_tree_dump(n, 0);
node *matched;
matched = r3_tree_match(n, "/post/11/22", NULL);
ck_assert(matched);
ck_assert(matched->endpoint > 0);
matched = r3_tree_match(n, "/post/11", NULL);
ck_assert(!matched);
matched = r3_tree_match(n, "/post/11/", NULL);
ck_assert(!matched);
matched = r3_tree_match(n, "/post/113", NULL);
ck_assert(!matched);
}
END_TEST
@ -725,6 +730,7 @@ Suite* r3_suite (void) {
tcase_add_test(tcase, test_pcre_pattern_more);
tcase_add_test(tcase, test_pcre_patterns_insert);
tcase_add_test(tcase, test_pcre_patterns_insert_2);
tcase_add_test(tcase, test_pcre_patterns_insert_3);
tcase_add_test(tcase, benchmark_str);
suite_add_tcase(suite, tcase);