@@ -3831,15 +3831,20 @@ BOOST_AUTO_TEST_CASE(testDayLists) {
38313831 Calendar germany = Germany ();
38323832 Date firstDate = Settings::instance ().evaluationDate (), endDate = firstDate + 1 * Years;
38333833
3834- // Test that same day holidayList and businessDayList does not throw an error
3835- germany.holidayList (firstDate, firstDate, true );
3836- germany.businessDayList (firstDate, firstDate);
3834+ // Test that a crossed range returns an empty vector
3835+ BOOST_CHECK_EQUAL (germany.holidayList (endDate, firstDate, true ).size (), 0 );
3836+ BOOST_CHECK_EQUAL (germany.businessDayList (endDate, firstDate).size (), 0 );
3837+ // Test that the range is inclusive on both sides
3838+ BOOST_CHECK_EQUAL (germany.holidayList (firstDate, firstDate, true ).size (),
3839+ static_cast <size_t >(germany.isHoliday (firstDate)));
3840+ BOOST_CHECK_EQUAL (germany.businessDayList (firstDate, firstDate).size (),
3841+ static_cast <size_t >(germany.isBusinessDay (firstDate)));
38373842
38383843 std::vector<Date> holidays = germany.holidayList (firstDate, endDate, true );
38393844 std::vector<Date> businessDays = germany.businessDayList (firstDate, endDate);
38403845
38413846 auto it_holidays = holidays.begin (), it_businessDays = businessDays.begin ();
3842- for (Date d = firstDate; d < endDate; d++) {
3847+ for (Date d = firstDate; d <= endDate; d++) {
38433848 if (it_holidays != holidays.end () && it_businessDays != businessDays.end () &&
38443849 d == *it_holidays && d == *it_businessDays) {
38453850 BOOST_FAIL (" Date " << d << " is both holiday and business day." );
0 commit comments