4 #include <gnu/option-groups.h>
13 #if __OPTION_POSIX_C_LANG_WIDE_CHAR
14 if (sprintf (buf, "%.0ls", L"foo") != 0
17 puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
20 #endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
22 #define SIZE (1024*70000)
25 char *dst = malloc (SIZE + 1);
29 puts ("memory allocation failure");
34 sprintf (dst, "%*s", SIZE, "");
35 if (strnlen (dst, SIZE + 1) != SIZE)
37 puts ("sprintf (dst, \"%*s\", " STR(SIZE) ", \"\") did not produce enough output");
43 if (sprintf (buf, "%1$d%3$.*2$s%4$d", 7, 67108863, "x", 8) != 3
44 || strcmp (buf, "7x8") != 0)
46 printf ("sprintf (buf, \"%%1$d%%3$.*2$s%%4$d\", 7, 67108863, \"x\", 8) produced `%s' output", buf);
50 if (sprintf (buf, "%67108863.16\"%d", 7) != 14
51 || strcmp (buf, "%67108863.16\"7") != 0)
53 printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output", buf);
57 if (sprintf (buf, "%*\"%d", 0x3ffffff, 7) != 11
58 || strcmp (buf, "%67108863\"7") != 0)
60 printf ("sprintf (buf, \"%%*\\\"%%d\", 0x3ffffff, 7) produced `%s' output", buf);