SmallCheck: a property-based testing library for Haskell
SmallCheck is a testing library that allows to verify properties for all test cases up to some depth. The test cases are generated automatically by SmallCheck.
Usefulness of such an approach to testing is based on the following observation:
If a program fails to meet its specification in some cases, it almost always fails in some simple case.
To get started with SmallCheck:
- Read the documentation
- If you have experience with QuickCheck, read the comparison of QuickCheck and SmallCheck
- Install it and give it a try!
cabal update; cabal install smallcheck
- Read the paper or other materials from the original authors of SmallCheck (note that that information might be somewhat outdated)
- If you see something that can be improved, please submit an issue
- Check out the source code at GitHub
Roman Cheplyaka is the primary maintainer.
Oliver Charles is the backup maintainer. Please get in touch with him if the primary maintainer cannot be reached.
Add instances for fixed-width Int and Word types (Int8, Word8 etc.)
Fix compatibility with GHC 7.8 and older
- Export the
- Add a
Export some auxiliary functions from
T.S.Series, and document how to express
N > 4.
- Add a
- Add the
NonEmptywrapper for lists
listM(the monadic version of
- Add optional explanation for test outcomes
Fix compatibility with GHC 7.4.1
Fix a bug where no test cases were generated for some functional types (#19).
Fix a bug in the generic instance
Make SmallCheck build with GHC 7.4
This is a major incompatible release of SmallCheck. Virtually every function has changed its name, type, semantics or module. So please carefully read the docs when upgrading.
For some highlights, see this blog post.
- Derive Typeable Property instance
- Add smallCheckPure
- Documentation improvements
- Make the package build with GHC 7.4.1
- Default Generic implementation of Serial instance (by Bas van Dijk)
- The code is split into modules
- Convert much of README into haddock documentation
- Many small API changes
- Remove impure Testable (IO a) instance
Make the package build with GHC 7.2. Some cosmetic changes.
The module SmallCheck is now Test.SmallCheck. Packaged with Cabal.
Existential quantifiers now have unique variants for which two witnesses are reported when uniqueness fails. The over-generating coseries method for functions of functional arguments has been replaced; now 'coseries' and the 'alts' family take a series argument. Test counters are now Integers, not Ints. Ord and Eq are now derived for the N types. Examples extended.
The 'smallCheck' driver now takes an argument d and runs test series at depths 0..d without interaction, stopping if any test fails. The interactive variant is still available as 'smallCheckI'. All Prelude numeric types now have Serial instances, including floating-point types. Serial types Nat and Natural are also defined. Examples extended.
The differences from 0.0 are two fixes (space-fault, output buffering), an 'unsafe' but sometimes useful Testable (IO a) instance and additional examples.