Skip to content

Commit 8d1c24b

Browse files
authored
fix: test case for interest_is_interesting_test.cpp
The test case titled "Years before large difference between start and target balance" contains an incorrect `want`. Currently, `want == 85`, but if we substitute this into the expressions `balance * (1 + (interest_rate / 100))^want` and `balance * (1 + (interest_rate / 100))^(want + 1)`, we see that both expressions have a value that is much lower than `target_balance`. This commit fixes this by setting `want` to the correct value.
1 parent acc3255 commit 8d1c24b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exercises/concept/interest-is-interesting/interest_is_interesting_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST_CASE("Years before desired balance for large start balance", "[task_4]") {
169169
TEST_CASE("Years before large difference between start and target balance", "[task_4]") {
170170
double balance{2345.67};
171171
double target_balance{12345.6789};
172-
int want{85};
172+
int want{104};
173173
REQUIRE(years_until_desired_balance(balance, target_balance) == want);
174174
}
175175
TEST_CASE("Balance is already above target", "[task_4]") {

0 commit comments

Comments
 (0)