6 char *q = strstr(p, sub); \
8 t_error("strstr(%s,%s) returned str+%d, wanted 0\n", #s, #sub, q-p); \
11 #define T(s, sub, n) { \
13 char *q = strstr(p, sub); \
15 t_error("strstr(%s,%s) returned 0, wanted str+%d\n", #s, #sub, n); \
16 else if (q - p != n) \
17 t_error("strstr(%s,%s) returned str+%d, wanted str+%d\n", #s, #sub, q-p, n); \
29 N("0-1-2-3-4-5-6-7-8-9", "-3-4-56-7-8-")
30 N("0-1-2-3-4-5-6-7-8-9", "-3-4-5+6-7-8-")
31 N("_ _ _\xff_ _ _", "_\x7f_")
32 N("_ _ _\x7f_ _ _", "_\xff_")
44 T("ababab", "babab", 1)
45 T("abababa", "bababa", 1)
46 T("abababab", "bababab", 1)
47 T("ababababa", "babababa", 1)
48 T("abbababab", "bababa", 2)
49 T("abbababab", "ababab", 3)
50 T("abacabcabcab", "abcabcab", 4)
51 T("nanabanabanana", "aba", 3)
52 T("nanabanabanana", "ban", 4)
53 T("nanabanabanana", "anab", 1)
54 T("nanabanabanana", "banana", 8)
55 T("_ _\xff_ _", "_\xff_", 2)