|
@@ -11,6 +11,9 @@
|
|
#include <ls-std/ls-std-time.hpp>
|
|
#include <ls-std/ls-std-time.hpp>
|
|
#include <utility>
|
|
#include <utility>
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ #include <windows.h>
|
|
|
|
+#endif
|
|
|
|
|
|
using ls::std::time::DateParameter;
|
|
using ls::std::time::DateParameter;
|
|
using ls::std::time::DateParameterMapper;
|
|
using ls::std::time::DateParameterMapper;
|
|
@@ -50,4 +53,39 @@ namespace
|
|
|
|
|
|
INSTANTIATE_TEST_SUITE_P(toUnixTimestamp, DateParameterMapperTest_Unix, Values(DateParameterMapperTest_Unix::getTestParameterList().at(0), DateParameterMapperTest_Unix::getTestParameterList().at(1)));
|
|
INSTANTIATE_TEST_SUITE_P(toUnixTimestamp, DateParameterMapperTest_Unix, Values(DateParameterMapperTest_Unix::getTestParameterList().at(0), DateParameterMapperTest_Unix::getTestParameterList().at(1)));
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ class DateParameterMapperTest_Windows : public TestWithParam<DateParameter>
|
|
|
|
+ {
|
|
|
|
+ public:
|
|
|
|
+
|
|
|
|
+ DateParameterMapperTest_Windows() = default;
|
|
|
|
+ ~DateParameterMapperTest_Windows() override = default;
|
|
|
|
+
|
|
|
|
+ static vector<DateParameter> getTestParameterList()
|
|
|
|
+ {
|
|
|
|
+ vector<DateParameter> testParameterList{};
|
|
|
|
+ testParameterList.emplace_back(1990, 10, 26, 11, 25, 00);
|
|
|
|
+ testParameterList.emplace_back(1989, 6, 1, 10, 52, 00);
|
|
|
|
+
|
|
|
|
+ return testParameterList;
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ TEST_P(DateParameterMapperTest_Windows, toWindowsSystemTime)
|
|
|
|
+ {
|
|
|
|
+ DateParameter dateParameter = GetParam();
|
|
|
|
+ SYSTEMTIME systemTime = DateParameterMapper::toWindowsSystemTime(dateParameter);
|
|
|
|
+
|
|
|
|
+ ASSERT_EQ(systemTime.wYear, GetParam().getYear());
|
|
|
|
+ ASSERT_EQ(systemTime.wMonth, GetParam().getMonth());
|
|
|
|
+ ASSERT_EQ(systemTime.wDayOfWeek, 0);
|
|
|
|
+ ASSERT_EQ(systemTime.wDay, GetParam().getDay());
|
|
|
|
+ ASSERT_EQ(systemTime.wHour, GetParam().getHour());
|
|
|
|
+ ASSERT_EQ(systemTime.wMinute, GetParam().getMinute());
|
|
|
|
+ ASSERT_EQ(systemTime.wSecond, GetParam().getSecond());
|
|
|
|
+ ASSERT_EQ(systemTime.wMilliseconds, 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ INSTANTIATE_TEST_SUITE_P(toWindowsSystemTime, DateParameterMapperTest_Windows, Values(DateParameterMapperTest_Windows::getTestParameterList().at(0), DateParameterMapperTest_Windows::getTestParameterList().at(1)));
|
|
|
|
+#endif
|
|
}
|
|
}
|