[Haskell-beginners] Quickcheck Preconditions

Jonas Almström Duregård jonas.duregard at chalmers.se
Wed May 25 17:42:53 CEST 2011


Not sure what you mean by "specifying bounds for quickcheck".


2011/5/25 Guy <guytsalmaves-h at yahoo.com>:
> Thanks, mod is a neat trick for applying the size. Is there a simple way of specifying bounds for quickcheck, or would I have to write a custom generator to do that?
>
>
>>________________________________
>>From: Jonas Almström Duregård <jonas.duregard at chalmers.se>
>>Sent: Wednesday, 25 May 2011, 14:09
>>Subject: Re: [Haskell-beginners] Quickcheck Preconditions
>>
>>
>>You can write your own generators and use the forall function. Or for these simple examples you can just test on wrappers:
>>
>>
>>testFoo :: (a,a,a,[a]) -> IO Bool
>>testFoo (a1,a2,a3,as) = foo (a1:a2:a3:as)
>>
>>
>>testBar :: (a,[a]) -> Int -> IO ()
>>testBar (x,xs) n = bar xs' (n `mod` length xs') where xs' = x:xs
>>
>>
>>/J
>



More information about the Beginners mailing list