The new API is more C-like and will allow consistency across all future supported language targets.
27 lines
538 B
D
27 lines
538 B
D
import testparser;
|
|
import std.stdio;
|
|
|
|
int main()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
unittest
|
|
{
|
|
string input = "a";
|
|
p_context_t context;
|
|
p_context_init(&context, input);
|
|
assert(p_parse(&context) == P_SUCCESS);
|
|
assert(p_result(&context) == 1u);
|
|
|
|
input = "";
|
|
p_context_init(&context, input);
|
|
assert(p_parse(&context) == P_SUCCESS);
|
|
assert(p_result(&context) == 0u);
|
|
|
|
input = "aaaaaaaaaaaaaaaa";
|
|
p_context_init(&context, input);
|
|
assert(p_parse(&context) == P_SUCCESS);
|
|
assert(p_result(&context) == 16u);
|
|
}
|