Loading lesson…
Level 1 · Apprentice0 XP
Let the computer generate thousands of inputs and find the edge cases you did not think of.
Step 1 / 6
ProblemA money-splitting function passes tests for 100/2, 100/3 and 10/4. In production, splitting 1 cent among 3 people loses a cent.
← → step
Before this: Flaky tests: causes and cures
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Write property tests for a function you own: a round-trip (parse(format(x)) == x), an invariant (totals add up) and an idempotence property (normalise twice equals once). Let it find and shrink a failure, then fix the bug.