Fix tests for #10
This commit is contained in:
parent
d4c2c6b47e
commit
4565346298
3 changed files with 38 additions and 36 deletions
|
@ -506,7 +506,6 @@ bool r3_node_has_slug_edges(node *n) {
|
||||||
|
|
||||||
|
|
||||||
void r3_tree_dump(node * n, int level) {
|
void r3_tree_dump(node * n, int level) {
|
||||||
if ( n->edge_len ) {
|
|
||||||
if ( n->combined_pattern ) {
|
if ( n->combined_pattern ) {
|
||||||
printf(" regexp:%s", n->combined_pattern);
|
printf(" regexp:%s", n->combined_pattern);
|
||||||
}
|
}
|
||||||
|
@ -533,7 +532,6 @@ void r3_tree_dump(node * n, int level) {
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,3 +179,10 @@
|
||||||
1400396341,10811271.16
|
1400396341,10811271.16
|
||||||
1400396368,10631572.01
|
1400396368,10631572.01
|
||||||
1400396396,10442039.18
|
1400396396,10442039.18
|
||||||
|
1400396467,10833155.84
|
||||||
|
1400396500,10639776.08
|
||||||
|
1400396541,9454881.65
|
||||||
|
1400396547,10795847.32
|
||||||
|
1400396725,10488850.71
|
||||||
|
1400396745,10442025.32
|
||||||
|
1400396765,10689592.72
|
||||||
|
|
|
|
@ -276,19 +276,15 @@ START_TEST(test_pcre_pattern_more)
|
||||||
int var2 = 200;
|
int var2 = 200;
|
||||||
int var3 = 300;
|
int var3 = 300;
|
||||||
|
|
||||||
printf("var0: %p\n", &var0);
|
info("var0: %p\n", &var0);
|
||||||
printf("var1: %p\n", &var1);
|
info("var1: %p\n", &var1);
|
||||||
printf("var2: %p\n", &var2);
|
info("var2: %p\n", &var2);
|
||||||
printf("var3: %p\n", &var3);
|
info("var3: %p\n", &var3);
|
||||||
|
|
||||||
r3_tree_insert_pathl(n, "/user/{id:\\d+}", strlen("/user/{id:\\d+}"), NULL, &var1);
|
r3_tree_insert_pathl(n, "/user/{id:\\d+}", strlen("/user/{id:\\d+}"), NULL, &var1);
|
||||||
r3_tree_dump(n, 0);
|
|
||||||
r3_tree_insert_pathl(n, "/user2/{id:\\d+}", strlen("/user2/{id:\\d+}"), NULL, &var2);
|
r3_tree_insert_pathl(n, "/user2/{id:\\d+}", strlen("/user2/{id:\\d+}"), NULL, &var2);
|
||||||
r3_tree_dump(n, 0);
|
|
||||||
r3_tree_insert_pathl(n, "/user3/{id:\\d{3}}", strlen("/user3/{id:\\d{3}}"), NULL, &var3);
|
r3_tree_insert_pathl(n, "/user3/{id:\\d{3}}", strlen("/user3/{id:\\d{3}}"), NULL, &var3);
|
||||||
r3_tree_dump(n, 0);
|
|
||||||
r3_tree_insert_pathl(n, "/user", strlen("/user"), NULL, &var0);
|
r3_tree_insert_pathl(n, "/user", strlen("/user"), NULL, &var0);
|
||||||
r3_tree_dump(n, 0);
|
|
||||||
r3_tree_compile(n);
|
r3_tree_compile(n);
|
||||||
r3_tree_dump(n, 0);
|
r3_tree_dump(n, 0);
|
||||||
node *matched;
|
node *matched;
|
||||||
|
@ -297,21 +293,22 @@ START_TEST(test_pcre_pattern_more)
|
||||||
fail_if(matched == NULL);
|
fail_if(matched == NULL);
|
||||||
ck_assert_int_gt(entry->vars->len, 0);
|
ck_assert_int_gt(entry->vars->len, 0);
|
||||||
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
||||||
fail_if( *((int*) matched->data), var1);
|
|
||||||
|
|
||||||
/*
|
info("matched %p\n", matched->data);
|
||||||
|
info("matched %p\n", matched->data);
|
||||||
|
ck_assert_int_eq( *((int*) matched->data), var1);
|
||||||
|
|
||||||
matched = r3_tree_match(n, "/user2/123", strlen("/user2/123"), entry);
|
matched = r3_tree_match(n, "/user2/123", strlen("/user2/123"), entry);
|
||||||
fail_if(matched == NULL);
|
fail_if(matched == NULL);
|
||||||
ck_assert_int_gt(entry->vars->len, 0);
|
ck_assert_int_gt(entry->vars->len, 0);
|
||||||
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
||||||
fail_if( *((int*)matched->data), var2);
|
ck_assert_int_eq( *((int*)matched->data), var2);
|
||||||
|
|
||||||
matched = r3_tree_match(n, "/user3/123", strlen("/user3/123"), entry);
|
matched = r3_tree_match(n, "/user3/123", strlen("/user3/123"), entry);
|
||||||
fail_if(matched == NULL);
|
fail_if(matched == NULL);
|
||||||
ck_assert_int_gt(entry->vars->len, 0);
|
ck_assert_int_gt(entry->vars->len, 0);
|
||||||
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
ck_assert_str_eq(entry->vars->tokens[0],"123");
|
||||||
fail_if( *((int*)matched->data), var3);
|
ck_assert_int_eq( *((int*)matched->data), var3);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue