File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,20 @@ BOOST_AUTO_TEST_CASE(testOperators) {
140
140
BOOST_TEST (p == Period (4 , Days));
141
141
}
142
142
143
+ BOOST_AUTO_TEST_CASE (testConvertToYears) {
144
+ BOOST_TEST_MESSAGE (" Testing converting periods to years..." );
145
+
146
+ BOOST_TEST (years (Period (0 , Years)) == 0 );
147
+ BOOST_TEST (years (Period (1 , Years)) == 1 );
148
+ BOOST_TEST (years (Period (5 , Years)) == 5 );
149
+
150
+ const auto tol = boost::test_tools::tolerance (1e-15 );
151
+ BOOST_TEST (years (Period (1 , Months)) == 1.0 /12.0 , tol);
152
+ BOOST_TEST (years (Period (8 , Months)) == 8.0 /12.0 , tol);
153
+ BOOST_TEST (years (Period (12 , Months)) == 1 );
154
+ BOOST_TEST (years (Period (18 , Months)) == 1.5 , tol);
155
+ }
156
+
143
157
BOOST_AUTO_TEST_CASE (testNormalization) {
144
158
145
159
BOOST_TEST_MESSAGE (" Testing period normalization..." );
You can’t perform that action at this time.
0 commit comments