Commit 06c796de authored by Pekka Pessi's avatar Pekka Pessi

test_memmem.c: warn about bad system memmem(), do not fail.

darcs-hash:20070321153640-55b16-7da2463125cd2640f334dc253e8bcbfc717044a4.gz
parent d0f3e5e5
......@@ -78,14 +78,25 @@ static int test_notfound(void)
TEST_P(memmem(haystack, 12, needle, 3), haystack + 2);
TEST_P(memmem(needle, 3, haystack, 12), NULL);
TEST_P(memmem(haystack, 12, "", 0), haystack);
TEST_P(memmem(haystack, 12, null, 0), haystack);
TEST_P(memmem(haystack, 0, "", 0), haystack);
TEST_P(memmem(haystack, 0, null, 0), haystack);
#if HAVE_MEMMEM
if (memmem(haystack, 12, "", 0) == NULL) {
fprintf(stderr, "test_memmem.c: "
"*** WARNING: system memmem() fails with empty needle ***\n");
}
else
#endif
{
TEST_P(memmem(haystack, 12, "", 0), haystack);
TEST_P(memmem(haystack, 12, null, 0), haystack);
TEST_P(memmem(haystack, 0, "", 0), haystack);
TEST_P(memmem(haystack, 0, null, 0), haystack);
}
TEST_P(memmem(haystack + 2, 3, needle, 3), haystack + 2);
TEST_P(memmem(haystack + 2, 2, needle, 3), NULL);
TEST_P(memmem(a = "a\0bc", 4, "a\0bc", 4), a);
TEST_P(memmem(a, 4, "\0bc", 3), a + 1);
END();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment