From fa88964f58919768b282e73b42dbab38f68502c6 Mon Sep 17 00:00:00 2001 From: Tarik02 Date: Sat, 18 Feb 2017 12:19:42 +0200 Subject: [PATCH] Check this test. --- unit_test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unit_test.c b/unit_test.c index ed5ca2f..a10207a 100644 --- a/unit_test.c +++ b/unit_test.c @@ -278,6 +278,16 @@ int main(void) { ASSERT(caps[2].ptr[0] == 'z'); } + { + /* Valid null-terminating test */ + static const char * str = ";hello\0\0"; + static const char * regex = "([^;])"; + struct slre_cap caps[1]; + ASSERT(slre_match(regex, str, strlen(str), caps, 1, 0) > 0); + printf("%s %d\n", caps[0].ptr, caps[0].len); + ASSERT(caps[0].len == 5); + } + printf("Unit test %s (total test: %d, failed tests: %d)\n", static_failed_tests > 0 ? "FAILED" : "PASSED", static_total_tests, static_failed_tests);