Comparison with QuickCheck

feuerbach edited this page Feb 12, 2013 · 2 revisions
Clone this wiki locally

If you are a QuickCheck user do you ever wish you could:

  • write test generators for your own types more easily?
  • be sure that any counter-examples found are minimal?
  • write properties using existentials as well as universals?
  • establish complete coverage of a defined test-space?
  • display counter-examples of functional type?
  • always repeat tests and obtain the same results?

If so, try SmallCheck!

In many ways SmallCheck is very similar to QuickCheck. It uses the idea of type-based generators for test data, and the way testable properties are expressed is closely based on the QuickCheck approach. Like QuickCheck, SmallCheck tests whether properties hold for finite completely defined values at specific types, and reports counter-examples.

The big difference is that instead of using a sample of randomly generated values, SmallCheck tests properties for all the finitely many values up to some depth, progressively increasing the depth used. For data values, depth means depth of construction. For functional values, it is a measure combining the depth to which arguments may be evaluated and the depth of possible results.