11 #define TEST(nr, result, format, args...) \
12 if (sprintf (buf, format, ## args) != result) \
14 printf ("test %d failed\n", nr); \
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);