awtk/tests/date_time_format_test.cc

17 lines
357 B
C++
Raw Normal View History

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-10-18 12:17:55 +08:00
ASSERT_EQ(strcmp(s.str, "70-01-01") == 0 || strcmp(s.str, "69-12-31") == 0, true);
2020-05-04 18:00:55 +08:00
str_reset(&s);
2020-01-12 10:24:50 +08:00
wstr_reset(&str);
}