123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-03-31
- * Changed: 2023-03-31
- *
- * */
- #include <gtest/gtest.h>
- #include <ls-std/ls-std-time.hpp>
- #include <utility>
- #include <vector>
- 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<pair<UnixTimestamp, DateParameter>>
- {
- public:
- DateParameterMapperTest() = default;
- ~DateParameterMapperTest() override = default;
- static vector<pair<UnixTimestamp, DateParameter>> getTestParameterList()
- {
- vector<pair<UnixTimestamp, DateParameter>> 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)));
- }
|