
12 Nov
2012
12 Nov
'12
5 p.m.
On Mon, Nov 12, 2012 at 10:14:30PM +0100, Simon Hengel wrote:
On Mon, Nov 12, 2012 at 07:21:06PM +0000, graham@fatlazycat.com wrote:
Hi,
Trying to find some good docs on QuickCheck, if anyone has one ?
Been scanning what I can find, but a question.
What would be the best way to generate two different/distinct integers ?
I would use Quickcheck's implication operator here:
quickCheck $ \x y -> x /= (y :: Int) ==> ...
That's good, but it only eliminates test cases after they have been generated. A slightly better (IMHO) version is to generate "correct" values in the first place: prop_Test :: Property prop_Test = forAll (arbitrary::Gen Int) $ \x -> forAll (arbitrary `suchThat` (/= x)) $ \y -> … regards, iustin