2020-01-12 10:24:50 +08:00
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include "base/date_time_format.h"
|
|
|
|
|
|
|
|
|
|
TEST(DateTimeFormat, basic) {
|
2020-05-04 18:00:55 +08:00
|
|
|
|
str_t s;
|
2020-01-12 10:24:50 +08:00
|
|
|
|
wstr_t str;
|
2020-05-04 18:00:55 +08:00
|
|
|
|
str_init(&s, 0);
|
2020-01-12 10:24:50 +08:00
|
|
|
|
wstr_init(&str, 0);
|
|
|
|
|
wstr_format_time(&str, "YY-MM-DD", 0);
|
2020-05-04 18:00:55 +08:00
|
|
|
|
|
|
|
|
|
str_from_wstr(&s, str.str);
|
2020-05-07 12:03:13 +08:00
|
|
|
|
#ifdef WIN32
|
2020-05-04 18:00:55 +08:00
|
|
|
|
ASSERT_STREQ(s.str, "00-00-00");
|
2020-05-08 11:05:40 +08:00
|
|
|
|
#elif defined(MACOS)
|
2020-05-04 18:00:55 +08:00
|
|
|
|
ASSERT_STREQ(s.str, "70-01-01");
|
2020-05-08 11:05:40 +08:00
|
|
|
|
#else
|
|
|
|
|
ASSERT_STREQ(s.str, "69-12-31");
|
2020-05-07 12:03:13 +08:00
|
|
|
|
#endif /*WIN32*/
|
2020-05-04 18:00:55 +08:00
|
|
|
|
str_reset(&s);
|
2020-01-12 10:24:50 +08:00
|
|
|
|
wstr_reset(&str);
|
|
|
|
|
}
|