basic radix tree for route patterns

This commit is contained in:
c9s 2014-05-15 18:28:33 +08:00
parent 7326933065
commit 4fb498c9b3
2 changed files with 5 additions and 3 deletions

View file

@ -43,6 +43,8 @@ rnode * rnode_insert_routel(rnode *tree, char *route, int route_len);
void rnode_dump(rnode * n, int level);
rnode * rnode_lookup(rnode * tree, char * path, int path_len);
redge * redge_create(char * pattern, int pattern_len, rnode * child);
void redge_free(redge * edge);

View file

@ -66,9 +66,9 @@ START_TEST (test_rnode_insert_tokens)
rnode_dump(n, 0);
fail_if( rnode_lookup(n, "/a/jj/kk", strlen("/a/jj/kk") ) == NULL );
fail_if( rnode_lookup(n, "/a/jj", strlen("/a/jj") ) != NULL );
fail_if( rnode_lookup(n, "/a/jj/kk/ll", strlen("/a/jj/kk/ll") ) != NULL );
fail_if( rnode_lookup(n , "/a/jj/kk" , strlen("/a/jj/kk") ) == NULL );
fail_if( rnode_lookup(n , "/a/jj" , strlen("/a/jj") ) != NULL );
fail_if( rnode_lookup(n , "/a/jj/kk/ll" , strlen("/a/jj/kk/ll") ) != NULL );
fail_if( rnode_lookup(n, "/xxxx", strlen("xxxx") ) != NULL );