diff --git a/README.md b/README.md index 115d8ef..fb24559 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ n = r3_tree_create(10); int route_data = 3; match_entry * entry = match_entry_create("/foo/bar"); +entry->request_method = METHOD_GET; // insert the route path into the router tree route *r1 = route_create("/blog/post"); diff --git a/tests/check_tree.c b/tests/check_tree.c index 10bcb38..885dcf0 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -247,6 +247,23 @@ START_TEST(test_route_cmp) END_TEST +START_TEST(test_pcre_pattern_simple) +{ + match_entry * entry; + entry = match_entry_createl( "/user/123" , strlen("/user/123") ); + + n = r3_tree_create(10); + r3_tree_insert_pathl(n, "/user/{id}", strlen("/user/{id}"), NULL, NULL); + r3_tree_insert_pathl(n, "/user", strlen("/user"), NULL, NULL); + r3_tree_compile(n); + r3_tree_dump(n, 0); + + + node *matched; + matched = r3_tree_match(n , "/blog/post", strlen("/blog/post"), entry); + + +} START_TEST(test_insert_route) {