Add test_feedback

This commit is contained in:
c9s 2014-05-22 17:07:02 +08:00
parent 3121937da5
commit a4378fdaf2
4 changed files with 26 additions and 0 deletions

View file

@ -181,6 +181,8 @@ void r3_route_free(route * route);
route * r3_tree_match_route(const node *n, match_entry * entry); route * r3_tree_match_route(const node *n, match_entry * entry);
void r3_tree_feedback(node *tree, node *end);
#define METHOD_GET 2 #define METHOD_GET 2
#define METHOD_POST 2<<1 #define METHOD_POST 2<<1
#define METHOD_PUT 2<<1 #define METHOD_PUT 2<<1

View file

@ -115,7 +115,12 @@ edge * r3_node_add_child(node * n, char * pat , node *child) {
return e; return e;
} }
void r3_tree_feedback(node *tree, node *end) {
edge * e;
while( (e = end->parent_edge) != NULL ) {
}
}
void r3_node_append_edge(node *n, edge *e) { void r3_node_append_edge(node *n, edge *e) {
if (n->edges == NULL) { if (n->edges == NULL) {

View file

@ -451,3 +451,5 @@
1400749175,13518288.33 1400749175,13518288.33
1400749320,13445606.30 1400749320,13445606.30
1400749326,13242705.99 1400749326,13242705.99
1400749599,13245418.70
1400749614,12494314.81

1 1400242718 5649455.80
451 1400749175 13518288.33
452 1400749320 13445606.30
453 1400749326 13242705.99
454 1400749599 13245418.70
455 1400749614 12494314.81

View file

@ -729,6 +729,23 @@ r3_tree_insert_path(n, "/garply/grault/corge", NULL);
} }
END_TEST END_TEST
START_TEST(test_feedback)
{
node * t = r3_tree_create(1);
r3_tree_insert_path(t, "/foo/bar/baz", NULL);
r3_tree_insert_path(t, "/foo/grault/bar", NULL);
r3_tree_insert_path(t, "/garply/corge/grault", NULL);
r3_tree_compile(t);
node * m = r3_tree_match(t, "/foo/grault/bar", NULL);
ck_assert(m != NULL);
r3_tree_feedback(t, m);
r3_tree_free(t);
}
END_TEST
Suite* r3_suite (void) { Suite* r3_suite (void) {
Suite *suite = suite_create("blah"); Suite *suite = suite_create("blah");