ANN: LeanCheck v0.9.0 -- enumerative property testing

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] 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] provides more details. A separate package [leancheck-instances] provides instances for other types in the Haskell Platform. _Installing._ You can find LeanCheck on [Hackage] or [GitHub]. It is also tracked on [Stackage]. As usual, you can install it with: $ cabal install leancheck -- Rudy [Hackage]: https://hackage.haskell.org/package/leancheck [GitHub]: https://github.com/rudymatela/leancheck [Stackage]: https://www.stackage.org/package/leancheck [LeanCheck's changelog]: https://hackage.haskell.org/package/leancheck/changelog [LeanCheck's Haddock documentation]: https://hackage.haskell.org/package/leancheck/docs/Test-LeanCheck.html

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.

Hi Arian, When in doubt and with a bit of time to spare, you can always use both :-) But here is some quick list of pros and cons: * LeanCheck/enumerative guarantees the smallest/simplest counterexample if one is found. This without the need of shrinking. * LeanCheck/enumerative allows for existential properties. * LeanCheck/enumerative guarantees that tests aren't repeated most of the time. * QuickCheck/random always hits different test cases, so in the long run you may get more test coverage. With LeanCheck you only get more coverage when you configure more tests. * LeanCheck/enumerative is more memory intensive when compared to QuickCheck/random. With LeanCheck you may run out of memory when you're running tens of millions of tests. You can find more details here: https://github.com/rudymatela/leancheck/blob/master/doc/faq.md#what-are-the-... On Thu, Jan 17, 2019 at 10:57:17AM +0100, Arian van Putten wrote:
Awesome. I always wondered what the pros/cons are compared to random testing like Quick check. When should I reach to enumerative testing?
participants (2)
-
Arian van Putten
-
Rudy Matela