
Awesome. I always wondered what the pros/cons are compared to random
testing like Quick check. When should I reach to enumerative testing?
On Thu, Jan 17, 2019, 03:11 Rudy Matela Hello Haskell Café, A new version of LeanCheck is out (v0.9.0). LeanCheck is a property
testing library (like QuickCheck) that tests values enumeratively. *Example.* Here’s a simple example of LeanCheck in action showing that
sorting is idempotent and list union is not commutative: import Test.LeanCheck
import Data.List (sort, union) check $ \xs -> sort (sort xs) == sort (xs::[Int])
+++ OK, passed 200 tests. check $ \xs ys -> xs `union` ys == ys `union` (xs::[Int])
*** Failed! Falsifiable (after 4 tests):
[] [0,0] LeanCheck works on all types that are instances of the Listable typeclass
and is able to derive instances automatically using either Template Haskell
or GHC.Generics. See LeanCheck’s Haddock documentation
https://hackage.haskell.org/package/leancheck/docs/Test-LeanCheck.html
for more details. *Whats new?* Version 0.9.0 marks the addition of Listable typeclass
instances for most standard Haskell types defined in the Haskell 2010
Language Report. This means you’ll be able to test more functions without
needing to define Listable instances yourself. LeanCheck’s changelog
https://hackage.haskell.org/package/leancheck/changelog provides more
details. A separate package [leancheck-instances] provides instances for other
types in the Haskell Platform. *Installing.* You can find LeanCheck on Hackage
https://hackage.haskell.org/package/leancheck or GitHub
https://github.com/rudymatela/leancheck. It is also tracked on Stackage
https://www.stackage.org/package/leancheck. As usual, you can install
it with: $ cabal install leancheck – Rudy
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.