1 #include <ccan/array_size/array_size.h>
2 #include <ccan/memmem/memmem.h>
3 #include <ccan/tap/tap.h>
7 char haystack1[] = "abcd\0efgh";
9 char needle2[] = "d\0e";
11 /* This is how many tests you plan to run */
14 ok1(memmem(haystack1, sizeof(haystack1), needle1, 2) == haystack1);
15 ok1(memmem(haystack1, sizeof(haystack1), needle1, 3) == NULL);
16 ok1(memmem(haystack1, sizeof(haystack1), needle2, 3) == (haystack1 + 3));
18 /* This exits depending on whether all tests passed */