/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2023-03-31 * Changed: 2023-03-31 * * */ #include #include #include #include using ls::std::time::DateParameter; using ls::std::time::DateParameterMapper; using ls::std::time::type::UnixTimestamp; using std::pair; using std::vector; using testing::TestWithParam; using testing::Values; namespace { class DateParameterMapperTest : public TestWithParam> { public: DateParameterMapperTest() = default; ~DateParameterMapperTest() override = default; static vector> getTestParameterList() { vector> testParameterList{}; testParameterList.emplace_back(656936700, DateParameter{1990, 10, 26, 11, 25, 00}); testParameterList.emplace_back(612694320, DateParameter{1989, 6, 1, 10, 52, 00}); return testParameterList; } }; TEST_P(DateParameterMapperTest, toUnixTimestamp) { DateParameter dateParameter = GetParam().second; UnixTimestamp timestamp = DateParameterMapper::toUnixTimestamp(dateParameter); ASSERT_EQ(GetParam().first, timestamp); } INSTANTIATE_TEST_SUITE_P(toUnixTimestamp, DateParameterMapperTest, Values(DateParameterMapperTest::getTestParameterList().at(0), DateParameterMapperTest::getTestParameterList().at(1))); }