News for hackers. Stuff that matters.
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 :)

Re:The evil unit test. by prodigal_erik on Monday January 30, 2012 @05:42PM (#3530940)
(FYI, 2 * 3 is okay; HN preserves * followed by whitespace.)
Re:The evil unit test. by tikhonj on Monday January 30, 2012 @06:26PM (#3531056)
Ah, thanks. That was probably the issue, because some of my asterisks worked but others didn't. I'll keep it in mind for the future.