19#include <boost/test/unit_test.hpp>
21#include <oret/toplevelfixture.hpp>
23using namespace boost::unit_test_framework;
27BOOST_FIXTURE_TEST_SUITE(OREDataTestSuite, ore::test::TopLevelFixture)
29BOOST_AUTO_TEST_SUITE(ScheduleDataTests)
33 BOOST_TEST_MESSAGE(
"Testing ScheduleData...");
35 ScheduleDates dates1(
"TARGET",
"",
"", {
"2015-01-09",
"2015-02-09",
"2015-03-09",
"2015-04-09"});
43 ScheduleRules rules1(
"2015-01-09",
"2015-04-09",
"1M",
"TARGET",
"MF",
"MF",
"Forward");
45 ScheduleRules rules2(
"2015-04-09",
"2018-04-09",
"1Y",
"TARGET",
"MF",
"MF",
"Forward");
49 data.addDates(dates2);
51 BOOST_CHECK_EQUAL(s.size(), 7UL);
52 BOOST_CHECK_EQUAL(s.startDate(), Date(9, Jan, 2015));
53 BOOST_CHECK_EQUAL(s.endDate(), Date(9, Apr, 2018));
57 data.addRules(rules2);
59 BOOST_CHECK_EQUAL(s2.size(), s.size());
60 for (Size i = 0; i < s.size(); i++)
61 BOOST_CHECK_EQUAL(s[i], s2[i]);
65 data.addRules(rules2);
67 BOOST_CHECK_EQUAL(s3.size(), s.size());
68 for (Size i = 0; i < s.size(); i++)
69 BOOST_CHECK_EQUAL(s[i], s3[i]);
77 vector<Date> expected{
79 Date(30, Jan, 2019), Date(24, Apr, 2019), Date(31, Jul, 2019), Date(30, Oct, 2019),
80 Date(29, Jan, 2020), Date(29, Apr, 2020), Date(29, Jul, 2020), Date(28, Oct, 2020),
81 Date(27, Jan, 2021), Date(28, Apr, 2021), Date(28, Jul, 2021), Date(27, Oct, 2021),
88 "Preceding",
"Unadjusted",
"LastWednesday")));
91 BOOST_CHECK_EQUAL_COLLECTIONS(s.dates().begin(), s.dates().end(), expected.begin(), expected.end());
94BOOST_AUTO_TEST_SUITE_END()
96BOOST_AUTO_TEST_SUITE_END()
Serializable schedule data.
Serializable object holding schedule Dates data.
Serializable object holding schedule Rules data.
Schedule makeSchedule(const ScheduleDates &data)
trade schedule data model and serialization
BOOST_AUTO_TEST_CASE(testScheduleData)