Re:The evil unit test.
by tikhonj on Monday January 30, 2012 @04:02PM
(#3530647)
Actually, his 2x3 example is not very good. The fact that 2x3 is 2 three times is the what, not the how; in a perfect world you would just assert that nxm == n + n + ... n m times for all n and all positive m.
This is, coincidentally, where property based testing like QuickCheck comes in.
Edit: Just pretend 2x3 has an asterisk instead of an x :)
This is, coincidentally, where property based testing like QuickCheck comes in.
Edit: Just pretend 2x3 has an asterisk instead of an x :)