Replace p_context_init() with p_context_new()/p_context_delete()
This commit is contained in:
1 parent
9f2fe6f84b
commit
6fd5186159
77 files changed
+728
-610
No files matched your search
@@ -6,32 +6,35 @@
|
||||
int main()
|
||||
{
|
||||
char const * input = "bbbb";
|
||||
p_context_t context;
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse(&context) == P_SUCCESS);
|
||||
Start * start = p_result(&context);
|
||||
p_context_t * context;
|
||||
context = p_context_new((uint8_t const *)input, strlen(input));
|
||||
assert(p_parse(context) == P_SUCCESS);
|
||||
Start * start = p_result(context);
|
||||
assert_not_null(start->bs);
|
||||
assert_not_null(start->bs->b);
|
||||
assert_not_null(start->bs->bs->b);
|
||||
assert_not_null(start->bs->bs->bs->b);
|
||||
assert_not_null(start->bs->bs->bs->bs->b);
|
||||
p_free_tree(start);
|
||||
p_context_delete(context);
|
||||
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_Bs(&context) == P_SUCCESS);
|
||||
Bs * bs = p_result_Bs(&context);
|
||||
context = p_context_new((uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_Bs(context) == P_SUCCESS);
|
||||
Bs * bs = p_result_Bs(context);
|
||||
assert_not_null(bs->b);
|
||||
assert_not_null(bs->bs->b);
|
||||
assert_not_null(bs->bs->bs->b);
|
||||
assert_not_null(bs->bs->bs->bs->b);
|
||||
p_free_tree_Bs(bs);
|
||||
p_context_delete(context);
|
||||
|
||||
input = "c";
|
||||
p_context_init(&context, (uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_R(&context) == P_SUCCESS);
|
||||
R * r = p_result_R(&context);
|
||||
context = p_context_new((uint8_t const *)input, strlen(input));
|
||||
assert(p_parse_R(context) == P_SUCCESS);
|
||||
R * r = p_result_R(context);
|
||||
assert_not_null(r->c);
|
||||
p_free_tree_R(r);
|
||||
p_context_delete(context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user