From b1ca20962bb1157045be7afb3ec67f2aea2bbbba Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 21 Apr 2017 15:55:04 +0900 Subject: [PATCH] add conversion test to datetime --- tests/test_datetime.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_datetime.cpp b/tests/test_datetime.cpp index e9cb35f..e315b51 100644 --- a/tests/test_datetime.cpp +++ b/tests/test_datetime.cpp @@ -6,6 +6,7 @@ #include #endif #include +#include BOOST_AUTO_TEST_CASE(test_datetime_convertible) { @@ -14,10 +15,16 @@ BOOST_AUTO_TEST_CASE(test_datetime_convertible) const std::chrono::system_clock::time_point cvt(d1); toml::Datetime d2(cvt); + BOOST_CHECK_EQUAL(d1, d2); + const auto time = std::chrono::system_clock::to_time_t(now); toml::Datetime d3(time); toml::Datetime d4(std::chrono::system_clock::from_time_t(time)); - BOOST_CHECK_EQUAL(d1, d2); BOOST_CHECK_EQUAL(d3, d4); + + std::this_thread::sleep_for(std::chrono::seconds(2)); + const auto later = std::chrono::system_clock::now(); + toml::Datetime d5(later); + BOOST_CHECK(d1 < d5); }