extrapolate-0.0.1: generalize counter-examples of test properties

Copyright(c) 2017 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellNone
LanguageHaskell2010

Test.Extrapolate

Description

Extrapolate is a library for generalization of counter-examples.

Consider the following faulty implementation of sort:

sort :: Ord a => [a] -> [a]
sort [] = []
sort (x:xs) = sort (filter (< x) xs)
           ++ [x]
           ++ sort (filter (> x) xs)

Extrapolate works like so:

> check $ \xs -> ordered (sort xs)
+++ OK, passed 360 tests!
> check $ \x xs -> count x (sort xs) == count x xs
*** Failed! Falsifiable (after 4 tests):
0 [0,0]
Generalization:
x (x:x:xs)

Documentation