test basic RE
This commit is contained in:
parent
8831c93ade
commit
241c4267e4
@ -32,9 +32,24 @@ static void test_asciiz_string()
|
||||
jairee_string_free(s);
|
||||
}
|
||||
|
||||
static void test_basic_re()
|
||||
{
|
||||
jairee_string_t * s = jairee_string_from_asciiz("abcd");
|
||||
jairee_re_t * re = jairee_compile(s);
|
||||
TEST(re != NULL);
|
||||
TEST(re->error == 0u);
|
||||
jairee_match_t * match = jairee_matchc(s, 0u, re);
|
||||
TEST(match != NULL);
|
||||
TEST(match->start == 0u);
|
||||
TEST(match->end == 4u);
|
||||
TEST(match->next == NULL);
|
||||
jairee_string_free(s);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
test_asciiz_string();
|
||||
test_basic_re();
|
||||
|
||||
printf("%d/%d tests passed\n", n_tests_passed, n_tests_passed + n_tests_failed);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user