13 { "%2000Y", 2000, 4000 },
14 { "%02000Y", 2000, 4000 },
15 { "%_2000Y", 2000, 4000 },
16 { "%-2000Y", 2000, 4000 },
18 #define ntests (sizeof (tests) / sizeof (tests[0]))
27 time_t tnow
= time (NULL
);
28 struct tm
*now
= localtime (&tnow
);
30 for (cnt
= 0; cnt
< ntests
; ++cnt
)
39 buf
= (char *) realloc (buf
, size
);
42 puts ("out of memory");
46 res
= strftime (buf
, size
, tests
[cnt
].fmt
, now
);
50 while (size
< tests
[cnt
].max
);
54 printf ("%Zu: %s: res == 0 despite size == %Zu\n",
55 cnt
, tests
[cnt
].fmt
, size
);
58 else if (size
< tests
[cnt
].min
)
60 printf ("%Zu: %s: size == %Zu was enough\n",
61 cnt
, tests
[cnt
].fmt
, size
);
65 printf ("%Zu: %s: size == %Zu: OK\n", cnt
, tests
[cnt
].fmt
, size
);
73 #define TEST_FUNCTION do_test ()
74 #include "../test-skeleton.c"