summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/utils.cpp b/tests/utils.cpp
index a18fc81..48951da 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -124,7 +124,19 @@ TEST_CASE("time_to_string")
TEST_CASE("parse_datetime")
{
- CHECK(utils::parse_datetime("1970-01-01T00:00:00z") == 0);
+ CHECK(utils::parse_datetime("1970-01-01T00:00:00Z") == 0);
+
+ const int twenty_three_hours = 82800;
+ CHECK(utils::parse_datetime("1970-01-01T23:00:12Z") == twenty_three_hours + 12);
+ CHECK(utils::parse_datetime("1970-01-01T23:00:12Z") == utils::parse_datetime("1970-01-01T23:00:12+00:00"));
+ CHECK(utils::parse_datetime("1970-01-01T23:00:12Z") == utils::parse_datetime("1970-01-01T23:00:12-00:00"));
+ CHECK(utils::parse_datetime("1970-01-02T00:00:12Z") == utils::parse_datetime("1970-01-01T23:00:12-01:00"));
+ CHECK(utils::parse_datetime("1970-01-02T00:00:12Z") == utils::parse_datetime("1970-01-02T01:00:12+01:00"));
+
CHECK(utils::parse_datetime("2016-08-29T14:29:29Z") == 1472480969);
+
CHECK(utils::parse_datetime("blah") == -1);
-} \ No newline at end of file
+ CHECK(utils::parse_datetime("1970-01-02T00:00:12B") == -1);
+ CHECK(utils::parse_datetime("1970-01-02T00:00:12*00:00") == -1);
+ CHECK(utils::parse_datetime("1970-01-02T00:00:12+0000") == -1);
+}