Hacker News new | ask | show | jobs
by tel 5390 days ago
It tends to be best for mathematical code because you can quickly think of invariances.

In any situation where you can state a powerful invariance your code must always be consistent with it's both fast and thorough. The common example is that (= str (reverse (reverse sequences))) for all sequences.

Note that this only tests invertibility. There are lots of ways reversal can be broken without violating this invariance. It's just really easy to write down this invariance and use it to rapidly check gross violations.