When we're not making fun little apps, we're making fun little libraries. We're porting QuickCheck, a really cool Haskell unit test framework. Instead of scattering thousands of assert statements throughout your code, QuickCheck works by testing properties. For example, encryption should have the property of being reversible.
propReversible :: Int -> String -> Bool propReversible password = (decrypt . encrypt) password == password
QuickCheck loves to test property functions, throwing a hundred tests cases at them. If any fail, QuickCheck displays the test case that failed. The framework goes one step further and even tries to reduce the test case to a simpler one that also fails, so debugging is easier. In Haskell and Erlang, QuickCheck can test property functions with arbitrary input types; it knows how to generate random variables of the types that the function expects.
YelloSoft now maintains ports of QuickCheck for Common Lisp, Factor, Node.js, and Smalltalk:
- cl-quickcheck - available through the Quicklisp package manager as "cl-quickcheck".
- factcheck - available through GitHub.
- node-quickcheck - available through the NPM package manager as "quickcheck".
- QuickSmash - available through GitHub.