diff --git a/tests/test_interestCalculator.c b/tests/test_interestCalculator.c index 1aa11ca..410f723 100644 --- a/tests/test_interestCalculator.c +++ b/tests/test_interestCalculator.c @@ -46,5 +46,40 @@ void test_initiateInterest(void) { } } +void test_initiateInterestFalse(void) { -#endif // TEST \ No newline at end of file + /* Arrange */ + + int length = 10; + float startAmount[] = {34, 233, 4400, 1600, 245, 34544, 3767.32, 1422, 5435, 8199}; + float yearlyInterest=12; + float durationInYears=2.5; + + float monthlyInterest=8; + float durationInMonths=3.9; + + float resultsYearly[length]; + float resultsMonthly[length]; + + float expectedYearly[]={0,0,0,0,0,0,0,0,0,0}; + float expectedMonthly[]={0,0,0,0,0,0,0,0,0,0}; + + /* Act */ + + for (int i = 0; i < length; i++) { + resultsYearly[i]=initiateInterest(startAmount[i],yearlyInterest/100, durationInYears); + } + for (int i = 0; i < length; i++) { + resultsMonthly[i]=initiateInterest(startAmount[i],monthlyInterest/100, durationInMonths); + } + + /* Assert*/ + + for (int i = 0; i < length; i++) { + TEST_ASSERT_FALSE(expectedYearly[i] == resultsYearly[i]); + TEST_ASSERT_FALSE(expectedMonthly[i] == resultsMonthly[i]); + } +} + + +#endif // TEST