This commit is contained in:
c9s 2014-05-18 14:13:04 +08:00
parent 684eac876c
commit 636f474cbc
2 changed files with 18 additions and 0 deletions

View file

@ -64,6 +64,7 @@ n = r3_tree_create(10);
int route_data = 3; int route_data = 3;
match_entry * entry = match_entry_create("/foo/bar"); match_entry * entry = match_entry_create("/foo/bar");
entry->request_method = METHOD_GET;
// insert the route path into the router tree // insert the route path into the router tree
route *r1 = route_create("/blog/post"); route *r1 = route_create("/blog/post");

View file

@ -247,6 +247,23 @@ START_TEST(test_route_cmp)
END_TEST 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) START_TEST(test_insert_route)
{ {