Add two tests for month_selector with month day.
And one to test if errors in parsing are reported.
This commit is contained in:
parent
2f2ffe130a
commit
395efc358b
1 changed files with 30 additions and 0 deletions
|
@ -1147,6 +1147,32 @@ BOOST_AUTO_TEST_CASE(OpeningHours_TestIsActive)
|
|||
BOOST_CHECK(GetTimeTuple("2015-08", fmt, time));
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue