diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2015-11-12 19:57:48 +0300 |
---|---|---|
committer | Sergey Magidovich <mgsergio@mapswithme.com> | 2015-11-12 19:57:48 +0300 |
commit | 395efc358b93524ace32572864ff7bb238ca84f8 (patch) | |
tree | 3a3c74db5900bbb35af9f013ec8236dd3e8a984d /3party | |
parent | 2f2ffe130af7ade0d959e21bc22c8c2fbf95b615 (diff) |
Add two tests for month_selector with month day.
And one to test if errors in parsing are reported.
Diffstat (limited to '3party')
-rw-r--r-- | 3party/opening_hours/opening_hours_tests/opening_hours_tests.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/3party/opening_hours/opening_hours_tests/opening_hours_tests.cpp b/3party/opening_hours/opening_hours_tests/opening_hours_tests.cpp index 28605ba789..a1d7e4d697 100644 --- a/3party/opening_hours/opening_hours_tests/opening_hours_tests.cpp +++ b/3party/opening_hours/opening_hours_tests/opening_hours_tests.cpp @@ -1148,6 +1148,32 @@ BOOST_AUTO_TEST_CASE(OpeningHours_TestIsActive) BOOST_CHECK(!IsActive(ranges[0], time)); } { + TMonthdayRanges ranges; + BOOST_CHECK(Parse("Sep 01", ranges)); + + std::tm time{}; + auto const fmt = "%Y-%m-%d"; + + BOOST_CHECK(GetTimeTuple("2015-09-01", fmt, time)); + BOOST_CHECK(IsActive(ranges[0], time)); + + BOOST_CHECK(GetTimeTuple("2014-09-02", fmt, time)); + BOOST_CHECK(!IsActive(ranges[0], time)); + } + { + TMonthdayRanges ranges; + BOOST_CHECK(Parse("2015 Sep 01", ranges)); + + std::tm time{}; + auto const fmt = "%Y-%m-%d"; + + BOOST_CHECK(GetTimeTuple("2015-09-01", fmt, time)); + BOOST_CHECK(IsActive(ranges[0], time)); + + BOOST_CHECK(GetTimeTuple("2014-09-01", fmt, time)); + BOOST_CHECK(!IsActive(ranges[0], time)); + } + { TYearRanges ranges; BOOST_CHECK(Parse("2011-2014", ranges)); @@ -1385,4 +1411,8 @@ BOOST_AUTO_TEST_CASE(OpeningHours_TestOpeningHours) BOOST_CHECK(GetTimeTuple("2015-11-10 12:30", fmt, time)); BOOST_CHECK(oh.IsClosed(mktime(&time))); } + { + OpeningHours oh("Nov +1"); + BOOST_CHECK(!oh.IsValid()); + } } |