leancheck: Cholesterol-free property-based testing

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

Properties are defined as Haskell functions returning a boolean value which
should be true for all possible choices of argument values. LeanCheck
applies enumerated argument values to these properties in search for a
counterexample. Properties can be viewed as parameterized unit tests.

LeanCheck works by producing tiers of test values: a possibly infinite list
of finite sublists of same-and-increasingly-sized values.

Maintainers' corner

Readme for leancheck-0.6.2

LeanCheck

LeanCheck is a simple enumerative property-based testing library. Properties
are defined as Haskell functions returning a boolean value which should be
True for all possible choices of argument values. LeanCheck applies
enumerated argument values to these properties in search for a counterexample.
Properties can be viewed as parameterized unit tests.

LeanCheck works by producing tiers of test values: a possibly infinite list
of finite sublists of same-and-increasingly-sized values. This enumeration is
similar to Feat's. However, the ranking and ordering of values are defined
differently. The interface is also different.

Installing

To install the latest LeanCheck version from Hackage, just run:

$ cabal update
$ cabal install leancheck

Checking if properties are True

To check if properties are True,
just use the function holds:: Testable a => Int -> a -> Bool.
It takes two arguments:
the number of values to test
and a property (function returning Bool),
then, it returns a boolean indicating whether the property holds.
See (ghci):

Finding counter examples

To find counter examples to properties,
you can use the function counterExample:: Testable a => Int -> a -> Maybe [String].
It takes two arguments:
the number of values to test
and a property (function returning Bool).
Then, it returns Nothing if no results are found or Just a list of Strings
representing the offending arguments to the property.
See (ghci):