Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Namespaces | Functions
dategeneration.cpp File Reference
#include "toplevelfixture.hpp"
#include <boost/test/unit_test.hpp>
#include <ql/time/calendars/target.hpp>
#include <qle/calendars/belgium.hpp>
#include <ql/time/schedule.hpp>

Go to the source code of this file.

Namespaces

namespace  check
 

Functions

void checkDates (const Schedule &s, const std::vector< Date > &expected)
 
void checkDay (const Schedule &s, Weekday w)
 
 BOOST_AUTO_TEST_CASE (testThirdThursday)
 
 BOOST_AUTO_TEST_CASE (testThirdFriday)
 
 BOOST_AUTO_TEST_CASE (testMondayAfterThirdFriday)
 
 BOOST_AUTO_TEST_CASE (testTuesdayAfterThirdFriday)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( testThirdThursday  )

Definition at line 60 of file dategeneration.cpp.

60 {
61
62 BOOST_TEST_MESSAGE("Testing ThirdThursday DateGeneration rule");
63
64 std::vector<Date> expectedDates;
65
66 expectedDates.push_back(Date(12, December, 2016));
67 expectedDates.push_back(Date(16, March, 2017));
68 expectedDates.push_back(Date(15, June, 2017));
69 expectedDates.push_back(Date(21, September, 2017));
70 expectedDates.push_back(Date(21, December, 2017));
71 expectedDates.push_back(Date(15, March, 2018));
72 expectedDates.push_back(Date(21, June, 2018));
73 expectedDates.push_back(Date(20, September, 2018));
74 expectedDates.push_back(Date(12, December, 2018));
75
76 Schedule s =
77 MakeSchedule().from(Date(12, December, 2016))
78 .to(Date(12, December, 2016) + Period(2, Years))
79 .withCalendar(TARGET())
80 .withTenor(3*Months)
81 .withConvention(ModifiedFollowing)
82 .withTerminationDateConvention(Unadjusted)
83 .withRule(DateGeneration::ThirdThursday);
84
85 check::checkDates(s, expectedDates);
86 check::checkDay(s, Thursday);
87}
void checkDates(const Schedule &s, const std::vector< Date > &expected)
void checkDay(const Schedule &s, Weekday w)
+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( testThirdFriday  )

Definition at line 89 of file dategeneration.cpp.

89 {
90
91 BOOST_TEST_MESSAGE("Testing ThirdFriday DateGeneration rule");
92
93 std::vector<Date> expectedDates;
94
95 expectedDates.push_back(Date(12, December, 2016));
96 expectedDates.push_back(Date(17, March, 2017));
97 expectedDates.push_back(Date(16, June, 2017));
98 expectedDates.push_back(Date(15, September, 2017));
99 expectedDates.push_back(Date(15, December, 2017));
100 expectedDates.push_back(Date(16, March, 2018));
101 expectedDates.push_back(Date(15, June, 2018));
102 expectedDates.push_back(Date(21, September, 2018));
103 expectedDates.push_back(Date(12, December, 2018));
104
105 Schedule s =
106 MakeSchedule().from(Date(12, December, 2016))
107 .to(Date(12, December, 2016) + Period(2, Years))
108 .withCalendar(TARGET())
109 .withTenor(3*Months)
110 .withConvention(ModifiedFollowing)
111 .withTerminationDateConvention(Unadjusted)
112 .withRule(DateGeneration::ThirdFriday);
113
114 check::checkDates(s, expectedDates);
115 check::checkDay(s, Friday);
116}
+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( testMondayAfterThirdFriday  )

Definition at line 118 of file dategeneration.cpp.

118 {
119
120 BOOST_TEST_MESSAGE("Testing MondayAfterThirdFriday DateGeneration rule");
121
122 std::vector<Date> expectedDates;
123
124 expectedDates.push_back(Date(12, December, 2016));
125 expectedDates.push_back(Date(20, March, 2017));
126 expectedDates.push_back(Date(19, June, 2017));
127 expectedDates.push_back(Date(18, September, 2017));
128 expectedDates.push_back(Date(18, December, 2017));
129 expectedDates.push_back(Date(19, March, 2018));
130 expectedDates.push_back(Date(18, June, 2018));
131 expectedDates.push_back(Date(24, September, 2018));
132 expectedDates.push_back(Date(12, December, 2018));
133
134 Schedule s =
135 MakeSchedule().from(Date(12, December, 2016))
136 .to(Date(12, December, 2016) + Period(2, Years))
137 .withCalendar(TARGET())
138 .withTenor(3*Months)
139 .withConvention(ModifiedFollowing)
140 .withTerminationDateConvention(Unadjusted)
141 .withRule(DateGeneration::MondayAfterThirdFriday);
142
143 check::checkDates(s, expectedDates);
144 check::checkDay(s, Monday);
145}
+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( testTuesdayAfterThirdFriday  )

Definition at line 147 of file dategeneration.cpp.

147 {
148
149 BOOST_TEST_MESSAGE("Testing TuesdayAfterThirdFriday DateGeneration rule");
150
151 std::vector<Date> expectedDates;
152
153 expectedDates.push_back(Date(12, December, 2016));
154 expectedDates.push_back(Date(21, March, 2017));
155 expectedDates.push_back(Date(20, June, 2017));
156 expectedDates.push_back(Date(19, September, 2017));
157 expectedDates.push_back(Date(19, December, 2017));
158 expectedDates.push_back(Date(20, March, 2018));
159 expectedDates.push_back(Date(19, June, 2018));
160 expectedDates.push_back(Date(25, September, 2018));
161 expectedDates.push_back(Date(12, December, 2018));
162
163 Schedule s =
164 MakeSchedule().from(Date(12, December, 2016))
165 .to(Date(12, December, 2016) + Period(2, Years))
166 .withCalendar(TARGET())
167 .withTenor(3*Months)
168 .withConvention(ModifiedFollowing)
169 .withTerminationDateConvention(Unadjusted)
170 .withRule(DateGeneration::TuesdayAfterThirdFriday);
171
172 check::checkDates(s, expectedDates);
173 check::checkDay(s, Tuesday);
174}
+ Here is the call graph for this function: