1 /* Copyright (C) 2000 Free Software Foundation. 2 3 Ensure all expected transformations of builtin strstr occur and 4 perform correctly. 5 6 Written by Kaveh R. Ghazi, 11/6/2000. */ 7 8 extern void abort(void); 9 extern char *strstr (const char *, const char *); 10 11 void main_test(void)12main_test (void) 13 { 14 const char *const foo = "hello world"; 15 16 if (strstr (foo, "") != foo) 17 abort(); 18 if (strstr (foo + 4, "") != foo + 4) 19 abort(); 20 if (strstr (foo, "h") != foo) 21 abort(); 22 if (strstr (foo, "w") != foo + 6) 23 abort(); 24 if (strstr (foo + 6, "o") != foo + 7) 25 abort(); 26 if (strstr (foo + 1, "world") != foo + 6) 27 abort(); 28 29 /* Test at least one instance of the __builtin_ style. We do this 30 to ensure that it works and that the prototype is correct. */ 31 if (__builtin_strstr (foo + 1, "world") != foo + 6) 32 abort(); 33 } 34