20#include <boost/test/unit_test.hpp>
23#include <ql/settings.hpp>
26using namespace boost::unit_test_framework;
32BOOST_AUTO_TEST_SUITE(CalendarTests)
36 BOOST_TEST_MESSAGE(
"Testing RussiaModified calendar");
38 Calendar russiaSettlement = Russia(Russia::Settlement);
39 Calendar russiaExchange = Russia(Russia::MOEX);
40 Calendar russiaModifiedSettlement =
RussiaModified(Russia::Settlement);
44 Date pre(31, December, 2011);
45 BOOST_CHECK_THROW(russiaExchange.isBusinessDay(pre), QuantLib::Error);
46 BOOST_CHECK_NO_THROW(russiaModifiedExchange.isBusinessDay(pre));
49 Date start2011(1, Jan, 2011);
50 Date end2011(31, Dec, 2011);
51 for(Date d = start2011; d <= end2011; d++) {
52 BOOST_CHECK_EQUAL(russiaSettlement.isBusinessDay(d), russiaModifiedSettlement.isBusinessDay(d));
53 BOOST_CHECK_EQUAL(russiaSettlement.isBusinessDay(d), russiaModifiedExchange.isBusinessDay(d));
57 Date start2012(1, Jan, 2012);
58 Date end2012(31, Dec, 2012);
59 for(Date d = start2012; d <= end2012; d++) {
60 BOOST_CHECK_EQUAL(russiaSettlement.isBusinessDay(d), russiaModifiedSettlement.isBusinessDay(d));
61 BOOST_CHECK_EQUAL(russiaExchange.isBusinessDay(d), russiaModifiedExchange.isBusinessDay(d));
66 BOOST_TEST_MESSAGE(
"Testing updated UAE calendar");
68 std::vector<QuantLib::Date> testDates{
92 for (
auto d:testDates){
94 switch (d.weekday()) {
95 case QuantLib::Friday:
96 case QuantLib::Saturday:
97 BOOST_TEST(!UAE.isBusinessDay(d));
100 BOOST_TEST(UAE.isBusinessDay(d));
104 switch (d.weekday()) {
105 case QuantLib::Saturday:
106 case QuantLib::Sunday:
107 BOOST_TEST(!UAE.isBusinessDay(d));
110 BOOST_TEST(UAE.isBusinessDay(d));
118BOOST_AUTO_TEST_SUITE_END()
120BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(testRussiaModified)
Islamic Weekends-only calendar.
Russian calendar, modified QuantLib Russia to extend MOEX before 2012.
Fixture that can be used at top level.