mktime: check signed shifts on long_int and time_t, too
[glibc.git] / stdio-common / bug13.c
blob1eca8185ca0d9f27a147209778722ee9413b3b80
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 (\"%s\", %d)\n", nr, buf, result); \
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;