September 2018
Intermediate to advanced
398 pages
9h 43m
English
Add the following tests underneath the previous one:
"RetCalc.nbOfMonthsSaving" should { "calculate how long I need to save before I can retire" in {...} "not crash if the resulting nbOfMonths is very high" in { val actual = RetCalc.nbOfMonthsSaving( interestRate = 0.01 / 12, nbOfMonthsInRetirement = 40 * 12, netIncome = 3000, currentExpenses = 2999, initialCapital = 0) val expected = 8280 actual should ===(expected) } "not loop forever if I enter bad parameters" in pending
We will implement the not loop forever later on. It is a good practice to write pending tests as soon as you think about new edge cases or other use cases for your function. It helps to keep a direction toward the end goal, and gives some momentum—as ...
Read now
Unlock full access