88TEST_CASE (" Minimal first interest rate" , " [task_1]" ) {
99 double balance{0 };
1010 double want{0.5 };
11- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
11+ REQUIRE_THAT (interest_rate (balance),
12+ Catch::Matchers::WithinRel (want, 0.000001 ));
1213}
1314
1415#if defined(EXERCISM_RUN_ALL_TESTS)
1516
1617TEST_CASE (" Tiny first interest rate" , " [task_1]" ) {
1718 double balance{0.000001 };
1819 double want{0.5 };
19- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
20+ REQUIRE_THAT (interest_rate (balance),
21+ Catch::Matchers::WithinRel (want, 0.000001 ));
2022}
2123
2224TEST_CASE (" Maximum first interest rate" , " [task_1]" ) {
2325 double balance{999.9999 };
2426 double want{0.5 };
25- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
27+ REQUIRE_THAT (interest_rate (balance),
28+ Catch::Matchers::WithinRel (want, 0.000001 ));
2629}
2730
2831TEST_CASE (" Minimal second interest rate" , " [task_1]" ) {
2932 double balance{1000.0 };
3033 double want{1.621 };
31- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
34+ REQUIRE_THAT (interest_rate (balance),
35+ Catch::Matchers::WithinRel (want, 0.000001 ));
3236}
3337
3438TEST_CASE (" Tiny second interest rate" , " [task_1]" ) {
3539 double balance{1000.0001 };
3640 double want{1.621 };
37- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
41+ REQUIRE_THAT (interest_rate (balance),
42+ Catch::Matchers::WithinRel (want, 0.000001 ));
3843}
3944
4045TEST_CASE (" Maximum second interest rate" , " [task_1]" ) {
4146 double balance{4999.9990 };
4247 double want{1.621 };
43- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
48+ REQUIRE_THAT (interest_rate (balance),
49+ Catch::Matchers::WithinRel (want, 0.000001 ));
4450}
4551
4652TEST_CASE (" Minimal third interest rate" , " [task_1]" ) {
4753 double balance{5000.0000 };
4854 double want{2.475 };
49- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
55+ REQUIRE_THAT (interest_rate (balance),
56+ Catch::Matchers::WithinRel (want, 0.000001 ));
5057}
5158
5259TEST_CASE (" Tiny third interest rate" , " [task_1]" ) {
5360 double balance{5000.0001 };
5461 double want{2.475 };
55- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
62+ REQUIRE_THAT (interest_rate (balance),
63+ Catch::Matchers::WithinRel (want, 0.000001 ));
5664}
5765
5866TEST_CASE (" Large third interest rate" , " [task_1]" ) {
5967 double balance{5639998.742909 };
6068 double want{2.475 };
61- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
69+ REQUIRE_THAT (interest_rate (balance),
70+ Catch::Matchers::WithinRel (want, 0.000001 ));
6271}
6372
6473TEST_CASE (" Rate on minimal negative balance" , " [task_1]" ) {
6574 double balance{-0.000001 };
6675 double want{3.213 };
67- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
76+ REQUIRE_THAT (interest_rate (balance),
77+ Catch::Matchers::WithinRel (want, 0.000001 ));
6878}
6979
7080TEST_CASE (" Rate on small negative balance" , " [task_1]" ) {
7181 double balance{-0.123 };
7282 double want{3.213 };
73- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
83+ REQUIRE_THAT (interest_rate (balance),
84+ Catch::Matchers::WithinRel (want, 0.000001 ));
7485}
7586
7687TEST_CASE (" Rate on regular negative balance" , " [task_1]" ) {
7788 double balance{-300.0 };
7889 double want{3.213 };
79- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
90+ REQUIRE_THAT (interest_rate (balance),
91+ Catch::Matchers::WithinRel (want, 0.000001 ));
8092}
8193
8294TEST_CASE (" Rate on large negative balance" , " [task_1]" ) {
8395 double balance{-152964.231 };
8496 double want{3.213 };
85- REQUIRE_THAT (interest_rate (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
97+ REQUIRE_THAT (interest_rate (balance),
98+ Catch::Matchers::WithinRel (want, 0.000001 ));
8699}
87100
88101TEST_CASE (" Interest on negative balance" , " [task_2]" ) {
89102 double balance{-10000.0 };
90103 double want{-321.3 };
91- REQUIRE_THAT (yearly_interest (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
104+ REQUIRE_THAT (yearly_interest (balance),
105+ Catch::Matchers::WithinRel (want, 0.000001 ));
92106}
93107TEST_CASE (" Interest on small balance" , " [task_2]" ) {
94108 double balance{555.43 };
95109 double want{2.77715 };
96- REQUIRE_THAT (yearly_interest (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
110+ REQUIRE_THAT (yearly_interest (balance),
111+ Catch::Matchers::WithinRel (want, 0.000001 ));
97112}
98113TEST_CASE (" Interest on medium balance" , " [task_2]" ) {
99114 double balance{4999.99 };
100115 double want{81.0498379 };
101- REQUIRE_THAT (yearly_interest (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
116+ REQUIRE_THAT (yearly_interest (balance),
117+ Catch::Matchers::WithinRel (want, 0.000001 ));
102118}
103119TEST_CASE (" Interest on large balance" , " [task_2]" ) {
104120 double balance{34600.80 };
105121 double want{856.3698 };
106- REQUIRE_THAT (yearly_interest (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
122+ REQUIRE_THAT (yearly_interest (balance),
123+ Catch::Matchers::WithinRel (want, 0.000001 ));
107124}
108125
109126TEST_CASE (" Annual balance update for empty start balance" , " [task_3]" ) {
110127 double balance{0.0 };
111128 double want{0.0000 };
112- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
129+ REQUIRE_THAT (annual_balance_update (balance),
130+ Catch::Matchers::WithinRel (want, 0.000001 ));
113131}
114132
115- TEST_CASE (" Annual balance update for small positive start balance" , " [task_3]" ) {
133+ TEST_CASE (" Annual balance update for small positive start balance" ,
134+ " [task_3]" ) {
116135 double balance{0.000001 };
117136 double want{0.000001005 };
118- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
137+ REQUIRE_THAT (annual_balance_update (balance),
138+ Catch::Matchers::WithinRel (want, 0.000001 ));
119139}
120140
121- TEST_CASE (" Annual balance update for average positive start balance" , " [task_3]" ) {
141+ TEST_CASE (" Annual balance update for average positive start balance" ,
142+ " [task_3]" ) {
122143 double balance{1000.0 };
123144 double want{1016.210000 };
124- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
145+ REQUIRE_THAT (annual_balance_update (balance),
146+ Catch::Matchers::WithinRel (want, 0.000001 ));
125147}
126148
127- TEST_CASE (" Annual balance update for large positive start balance" , " [task_3]" ) {
149+ TEST_CASE (" Annual balance update for large positive start balance" ,
150+ " [task_3]" ) {
128151 double balance{1000.2001 };
129152 double want{1016.413343621 };
130- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
153+ REQUIRE_THAT (annual_balance_update (balance),
154+ Catch::Matchers::WithinRel (want, 0.000001 ));
131155}
132156
133157TEST_CASE (" Annual balance update for huge positive start balance" , " [task_3]" ) {
134158 double balance{898124017.826243404425 };
135159 double want{920352587.2674429417 };
136- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
160+ REQUIRE_THAT (annual_balance_update (balance),
161+ Catch::Matchers::WithinRel (want, 0.000001 ));
137162}
138163
139- TEST_CASE (" Annual balance update for small negative start balance" , " [task_3]" ) {
164+ TEST_CASE (" Annual balance update for small negative start balance" ,
165+ " [task_3]" ) {
140166 double balance{-0.123 };
141167 double want{-0.12695199 };
142- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
168+ REQUIRE_THAT (annual_balance_update (balance),
169+ Catch::Matchers::WithinRel (want, 0.000001 ));
143170}
144171
145- TEST_CASE (" Annual balance update for large negative start balance" , " [task_3]" ) {
172+ TEST_CASE (" Annual balance update for large negative start balance" ,
173+ " [task_3]" ) {
146174 double balance{-152964.231 };
147175 double want{-157878.97174203 };
148- REQUIRE_THAT (annual_balance_update (balance), Catch::Matchers::WithinRel (want, 0.000001 ));
176+ REQUIRE_THAT (annual_balance_update (balance),
177+ Catch::Matchers::WithinRel (want, 0.000001 ));
149178}
150179
151180TEST_CASE (" Years before desired balance for small start balance" , " [task_4]" ) {
@@ -154,7 +183,8 @@ TEST_CASE("Years before desired balance for small start balance", "[task_4]") {
154183 int want{47 };
155184 REQUIRE (years_until_desired_balance (balance, target_balance) == want);
156185}
157- TEST_CASE (" Years before desired balance for average start balance" , " [task_4]" ) {
186+ TEST_CASE (" Years before desired balance for average start balance" ,
187+ " [task_4]" ) {
158188 double balance{1000.0 };
159189 double target_balance{1100.0 };
160190 int want{6 };
@@ -166,7 +196,8 @@ TEST_CASE("Years before desired balance for large start balance", "[task_4]") {
166196 int want{5 };
167197 REQUIRE (years_until_desired_balance (balance, target_balance) == want);
168198}
169- TEST_CASE (" Years before large difference between start and target balance" , " [task_4]" ) {
199+ TEST_CASE (" Years before large difference between start and target balance" ,
200+ " [task_4]" ) {
170201 double balance{2345.67 };
171202 double target_balance{12345.6789 };
172203 int want{85 };
0 commit comments