1 /* Copyright (C) 2000, 2004 Free Software Foundation.
3 Ensure all expected transformations of builtin strcspn occur and
6 Written by Kaveh R. Ghazi, 11/27/2000. */
8 extern void abort (void);
9 typedef __SIZE_TYPE__
size_t;
10 extern size_t strcspn (const char *, const char *);
11 extern char *strcpy (char *, const char *);
16 const char *const s1
= "hello world";
19 if (strcspn (s1
, "hello") != 0)
21 if (strcspn (s1
, "z") != 11)
23 if (strcspn (s1
+4, "z") != 7)
25 if (strcspn (s1
, "hello world") != 0)
27 if (strcspn (s1
, "") != 11)
30 if (strcspn (dst
, "") != 11)
32 strcpy (dst
, s1
); d2
= dst
;
33 if (strcspn (++d2
, "") != 10 || d2
!= dst
+1)
35 strcpy (dst
, s1
); d2
= dst
;
36 if (strcspn (++d2
+5, "") != 5 || d2
!= dst
+1)
38 if (strcspn ("", s1
) != 0)
41 if (strcspn ("", dst
) != 0)
43 strcpy (dst
, s1
); d2
= dst
;
44 if (strcspn ("", ++d2
) != 0 || d2
!= dst
+1)
46 strcpy (dst
, s1
); d2
= dst
;
47 if (strcspn ("", ++d2
+5) != 0 || d2
!= dst
+1)
50 /* Test at least one instance of the __builtin_ style. We do this
51 to ensure that it works and that the prototype is correct. */
52 if (__builtin_strcspn (s1
, "z") != 11)