From 1140db3b88bb70cbcab044efa729707bd5a442f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 31 Aug 2016 01:58:13 +0200 Subject: Add parse_datetime --- tests/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/utils.cpp') diff --git a/tests/utils.cpp b/tests/utils.cpp index abe7ef7..084a048 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -121,3 +121,11 @@ TEST_CASE("time_to_string") CHECK(utils::to_string(stamp).size() == result.size()); CHECK(utils::to_string(0) == "1970-01-01T00:00:00Z"); } + +TEST_CASE("parse_datetime") +{ + const auto time = utils::parse_datetime("1970-01-01T00:00:00Z"); + CHECK(time == 0); + CHECK(utils::parse_datetime("2016-08-29T14:29:28Z") == 1472480968); + CHECK(utils::parse_datetime("blah") == -1); +} \ No newline at end of file -- cgit v1.2.3