this post was submitted on 16 Sep 2024
127 points (95.7% liked)

Programmer Humor

32048 readers
1295 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 14 points 3 days ago* (last edited 3 days ago) (1 children)

This is why it's important to have tests that assert a system's failure modes too.

shouldFitTriangleInTriangleHole()

shouldNotFitTriangleInAnyOtherHoles()

Bonus points for just parameterizing it.

[โ€“] [email protected] 3 points 2 days ago
 assert triangleObject.shouldFitInHole(triangleHole) == true

assert triangleObject.shouldFitInHole(squareHole) == false