[Haskell-cafe] [ANN] LeanCheck & Extrapolate: enumerative property-based testing & generalization of counter-examples

Rudy Matela rudy at matela.com.br
Mon Aug 14 09:59:32 UTC 2017


Hello Haskell-café,

I am happy to announce LeanCheck and Extrapolate, two enumerative
property-based testing libraries (a.k.a. QuickCheck-style testing).

https://hackage.haskell.org/package/leancheck
https://hackage.haskell.org/package/extrapolate

LeanCheck is a list-based enumerative property-based testing library with
a very small core of only 180 lines of code.  LeanCheck is somewhat stable
and has actually been around for a while, but this is its first
announcement on haskell-café.  It works like so:

	$ ghci
	> import Test.LeanCheck
	> check $ \x y -> x + y == y + (x :: Int)
	+++ OK, passed 200 tests.

Extrapolate works on top of LeanCheck, and its able to produce generalized
counter-examples in addition to fully defined ones.  Like so:

	$ ghci
	> import Test.Extrapolate
	> import Data.List (nub)
	> check $ \xs -> nub xs == (xs :: [Int])
	*** Failed! Falsifiable (after 3 tests):
	[0,0]

	Generalization:
	x:x:_

	Conditional Generalization:
	x:xs  when  elem x xs

Extrapolate is under active development at the moment.


To install both libraries, just:

	$ cabal update
	$ cabal install leancheck
	$ cabal install extrapolate

They are also available on Stackage, installable via 'stack install':

	https://www.stackage.org/package/leancheck (lts-9 and nightly)
	https://www.stackage.org/package/extrapolate (just nightly)

--
Rudy


More information about the Haskell-Cafe mailing list