|
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) |
@@ -110,15 +111,18 @@ TEST(Date, DatabaseStringTest) |
110 | 111 | TEST(Date, TimezoneTest) |
111 | 112 | { |
112 | 113 | std::string str0 = "2024-01-01 04:00:00.123"; |
113 | | - std::string str1 = "2024-01-01 12:00:00.123 +08:00"; |
114 | | - std::string str2 = "2024-01-01 11:00:00.123+0700"; |
115 | | - std::string str3 = "2024-01-01 10:00:00.123 0600"; |
116 | | - std::string str4 = "2024-01-01 03:00:00.123 -01:00"; |
117 | | - std::string str5 = "2024-01-01 02:00:00.123-02:00"; |
118 | | - std::string str6 = "2024-01-01 01:00:00.123 -0300"; |
| 114 | + std::vector<std::string> strs{"2024-01-01 12:00:00.123 +08:00", |
| 115 | + "2024-01-01 11:00:00.123+0700", |
| 116 | + "2024-01-01 10:00:00.123 0600", |
| 117 | + "2024-01-01 03:00:00.123 -01:00", |
| 118 | + "2024-01-01 02:00:00.123-02:00", |
| 119 | + "2024-01-01 01:00:00.123 -0300", |
| 120 | + "2024-01-01 12:00:00.123 08", |
| 121 | + "2024-01-01 02:00:00.123-02", |
| 122 | + "2024-01-01 14:00:00.123+10"}; |
119 | 123 |
|
120 | 124 | auto date = trantor::Date::fromDbString(str0); |
121 | | - for (auto &s : {str1, str2, str3, str4, str5, str6}) |
| 125 | + for (auto &s : strs) |
122 | 126 | { |
123 | 127 | auto dateTz = trantor::Date::parseDatetimeTz(s); |
124 | 128 | EXPECT_EQ(date.microSecondsSinceEpoch(), |
|
0 commit comments