Skip to content

Commit

Permalink
Add more start-of-month and end-of-month calendar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
igitur committed Jul 24, 2024
1 parent 71b79d7 commit 6331e50
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test-suite/calendars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3386,6 +3386,11 @@ BOOST_AUTO_TEST_CASE(testStartOfMonth) {
// check that som is in the same month as counter
if (som.month() != counter.month())
BOOST_FAIL("\n " << som << " is not in the same month as " << counter);
// Check that previous business day is in a different month
if (c.advance(som, -1, Days, Unadjusted).month() == som.month())
BOOST_FAIL("\n " << c.advance(som, -1, Days, Unadjusted)
<< " is in the same month as "
<< som);
counter = counter + 1;
}
}
Expand All @@ -3407,6 +3412,11 @@ BOOST_AUTO_TEST_CASE(testEndOfMonth) {
// check that eom is in the same month as counter
if (eom.month() != counter.month())
BOOST_FAIL("\n " << eom << " is not in the same month as " << counter);
// Check that next business day is in a different month
if (c.advance(eom, 1, Days, Unadjusted).month() == eom.month())
BOOST_FAIL("\n " << c.advance(eom, 1, Days, Unadjusted)
<< " is in the same month as "
<< eom);
counter = counter + 1;
}
}
Expand Down

0 comments on commit 6331e50

Please sign in to comment.