]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
test: Improve code coverage for strnstr(3) unit tests
authorGuillem Jover <guillem@hadrons.org>
Sun, 7 Feb 2021 22:24:51 +0000 (23:24 +0100)
committerGuillem Jover <guillem@hadrons.org>
Sun, 7 Feb 2021 22:24:51 +0000 (23:24 +0100)
test/strnstr.c

index 6cef2814fee08da608dc6464cd68ebb9fd0a5616..3d89fa8f33a93dd7fdf21ddd3cdcb5ba62da4ac7 100644 (file)
@@ -35,11 +35,15 @@ main(int argc, char **argv)
 
        assert(strnstr(large, "", strlen(large)) == large);
 
+       assert(strnstr(large, "far", strlen(large)) == NULL);
        assert(strnstr(large, "quux", strlen(large)) == NULL);
 
        assert(strnstr(large, small, 4) == NULL);
 
        assert(strnstr(large, small, strlen(large)) == (large + 4));
 
+       assert(strnstr("quux", large, strlen("quux")) == NULL);
+       assert(strnstr("foo", large, strlen("foo")) == NULL);
+
        return 0;
 }