aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index dd908e5ce..65246c05c 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -5782,6 +5782,13 @@ void strnstrUnitTest(void) {
/* Test 13 */
assert(ndpi_strnstr("abcdef", "abc", 2) == NULL);
+
+ /* Test 14: zero length */
+ assert(strcmp(ndpi_strnstr("", "", 0), "") == 0);
+ assert(strcmp(ndpi_strnstr("string", "", 0), "string") == 0);
+ assert(ndpi_strnstr("", "str", 0) == NULL);
+ assert(ndpi_strnstr("string", "str", 0) == NULL);
+ assert(ndpi_strnstr("str", "string", 0) == NULL);
}
/* *********************************************** */