Update.
[glibc.git] / stdio-common / bug13.c
blob17b7ff9825f45338aaab6760adb54ede57956f91
1 #include <stdio.h>
5 int
6 main (void)
8 int res = 0;
9 char buf[100];
11 #define TEST(nr, result, format, args...) \
12 if (sprintf (buf, format, ## args) != result) \
13 { \
14 printf ("test %d failed\n", nr); \
15 res = 1; \
18 TEST (1, 2, "%d", -1);
19 TEST (2, 2, "% 2d", 1);
20 TEST (3, 3, "%#x", 1);
21 TEST (4, 2, "%+d", 1);
22 TEST (5, 2, "% d", 1);
23 TEST (6, 2, "%-d", -1);
24 TEST (7, 2, "%- 2d", 1);
25 TEST (8, 3, "%-#x", 1);
26 TEST (9, 2, "%-+d", 1);
27 TEST (10, 2, "%- d", 1);
29 return res;