
Just to walk the walk, and not just talk the talk, here's a quick unit testing 'diff' driver I hacked up for QuickCheck. When run, it 'diffs' (well, just prints ;-) the incorrect values from the unit test: $ runhaskell T.hs sort unit test : Falsifiable after 0 tests: - [1,2,3] + [1,3,2]
From a normal QC specification like:
prop0 = (sort [3,2,1], [1,3,2]) main = mapM_ (\(s,a) -> printf "%-25s: " s >> a n) tests where n = 100 tests = [("sort unit test", mytest prop0)] The full driver code is attached. It is just proof of concept, but you can see how to extend it to be smarter/prettier. Note that we actually probably want to use SmallCheck here, to prevent bogus repetition of the test. (I.e. 500 tests all passed, for a unit test). Note also, the driver would need further extending, since we've changed the structure of the Testable values. Cheers, Don