13 memset (&tm
, 0xaa, sizeof (tm
));
15 /* Test we don't crash on uninitialized struct tm.
16 Some fields might contain bogus values until everything
17 needed is initialized, but we shouldn't crash. */
18 if (strptime ("2007", "%Y", &tm
) == NULL
19 || strptime ("12", "%d", &tm
) == NULL
20 || strptime ("Feb", "%b", &tm
) == NULL
21 || strptime ("13", "%M", &tm
) == NULL
22 || strptime ("21", "%S", &tm
) == NULL
23 || strptime ("16", "%H", &tm
) == NULL
)
25 puts ("strptimes failed");
29 if (tm
.tm_sec
!= 21 || tm
.tm_min
!= 13 || tm
.tm_hour
!= 16
30 || tm
.tm_mday
!= 12 || tm
.tm_mon
!= 1 || tm
.tm_year
!= 107
31 || tm
.tm_wday
!= 1 || tm
.tm_yday
!= 42)
33 puts ("unexpected tm content");
37 if (strptime ("8", "%d", &tm
) == NULL
)
39 puts ("strptime failed");
43 if (tm
.tm_sec
!= 21 || tm
.tm_min
!= 13 || tm
.tm_hour
!= 16
44 || tm
.tm_mday
!= 8 || tm
.tm_mon
!= 1 || tm
.tm_year
!= 107
45 || tm
.tm_wday
!= 4 || tm
.tm_yday
!= 38)
47 puts ("unexpected tm content");
54 #define TEST_FUNCTION do_test ()
55 #include "../test-skeleton.c"