We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc6ad67 commit fd5d65bCopy full SHA for fd5d65b
test/common/DateTimeTest.cpp
@@ -7,5 +7,16 @@ class DateTimeTest : public testing::Test {};
7
8
TEST_F(DateTimeTest, CreateTest) {
9
DateTime dt;
10
- EXPECT_EQ(dt.year, 2025);
+ const time_t ts = ::time(nullptr);
11
+ tm now{};
12
+#if defined(_WIN32)
13
+ ::localtime_s(&now, &ts);
14
++#else
15
+ ::localtime_r(&ts, &now);
16
++#endif
17
+ EXPECT_EQ(dt.year, static_cast<uint32_t>(now.tm_year + 1900));
18
+ EXPECT_GE(dt.month, 1u);
19
+ EXPECT_LE(dt.month, 12u);
20
+ EXPECT_GE(dt.day, 1u);
21
+ EXPECT_LE(dt.day, 31u);
22
}
0 commit comments