]>
git.saurik.com Git - apple/libc.git/blob - tests/strptime.c
7cbca30b5bfd12e58a08e3ef19b695f0fcd45190
3 #include <darwintest.h>
4 #include <darwintest_utils.h>
6 T_DECL(strptime_PR_27004626
, "strptime() should fail when a %t doesn't match anything")
9 T_ASSERT_NULL(strptime("there'snotemplateforthis", "%t", &tm
), NULL
);
12 T_DECL(strptime_PR_29381762
, "strptime() sets the tm_wday field incorrectly")
15 struct tm t
= *localtime(&epoch
);
17 T_LOG("2015-01-01 12:00:00 -> Thursday");
18 (void)strptime("2015-01-01 12:00:00", "%F %T", &t
);
19 T_EXPECT_EQ(t
.tm_wday
, 4, NULL
);
21 T_LOG("2015-04-19 12:00:00 -> Sunday");
22 (void)strptime("2015-04-19 12:00:00", "%F %T", &t
);
23 T_EXPECT_EQ(t
.tm_wday
, 0, NULL
);
25 T_LOG("2009-03-03 12:00:00 -> Tuesday");
26 (void)strptime("2009-03-03 12:00:00", "%F %T", &t
);
27 T_EXPECT_EQ(t
.tm_wday
, 2, NULL
);
29 T_LOG("1990-02-15 12:00:00 -> Thursday");
30 (void)strptime("1990-02-15 12:00:00", "%F %T", &t
);
31 T_EXPECT_EQ(t
.tm_wday
, 4, NULL
);
33 T_LOG("1993-03-02 12:00:00 -> Sunday");
34 (void)strptime("1993-03-02 12:00:00", "%F %T", &t
);
35 T_EXPECT_EQ(t
.tm_wday
, 2, NULL
);