|
1 | 1 | #include <trantor/utils/Date.h> |
2 | 2 | #include <gtest/gtest.h> |
3 | 3 | #include <string> |
| 4 | +#include <vector> |
4 | 5 | #include <iostream> |
5 | 6 | using namespace trantor; |
6 | 7 | TEST(Date, constructorTest) |
@@ -115,15 +116,18 @@ TEST(Date, DatabaseStringTest) |
115 | 116 | TEST(Date, TimezoneTest) |
116 | 117 | { |
117 | 118 | std::string str0 = "2024-01-01 04:00:00.123"; |
118 | | - std::string str1 = "2024-01-01 12:00:00.123 +08:00"; |
119 | | - std::string str2 = "2024-01-01 11:00:00.123+0700"; |
120 | | - std::string str3 = "2024-01-01 10:00:00.123 0600"; |
121 | | - std::string str4 = "2024-01-01 03:00:00.123 -01:00"; |
122 | | - std::string str5 = "2024-01-01 02:00:00.123-02:00"; |
123 | | - std::string str6 = "2024-01-01 01:00:00.123 -0300"; |
| 119 | + std::vector<std::string> strs{"2024-01-01 12:00:00.123 +08:00", |
| 120 | + "2024-01-01 11:00:00.123+0700", |
| 121 | + "2024-01-01 10:00:00.123 0600", |
| 122 | + "2024-01-01 03:00:00.123 -01:00", |
| 123 | + "2024-01-01 02:00:00.123-02:00", |
| 124 | + "2024-01-01 01:00:00.123 -0300", |
| 125 | + "2024-01-01 12:00:00.123 08", |
| 126 | + "2024-01-01 02:00:00.123-02", |
| 127 | + "2024-01-01 14:00:00.123+10"}; |
124 | 128 |
|
125 | 129 | auto date = trantor::Date::fromDbString(str0); |
126 | | - for (auto &s : {str1, str2, str3, str4, str5, str6}) |
| 130 | + for (auto &s : strs) |
127 | 131 | { |
128 | 132 | auto dateTz = trantor::Date::parseDatetimeTz(s); |
129 | 133 | EXPECT_EQ(date.microSecondsSinceEpoch(), |
|
0 commit comments