
18 Dec
2012
18 Dec
'12
1:38 p.m.
Thanks, how does using /= not cause test failures ? Just the sample rate will be high enough ? On Tue, Dec 18, 2012, at 06:04 PM, Simon Hengel wrote:
On Tue, Dec 18, 2012 at 05:25:41PM +0000, graham@fatlazycat.com wrote:
Are there any libraries that define various common generators ?
What would be the cleanest way to define two positive integers below 1000 that are different ? Seems relatively easy with conditionals.
You can still use (==>) to ensure that two numbers are different. I would use something like this:
newtype Small = Small Int deriving Show
instance Arbitrary Small where arbitrary = Small . (`mod` 1000) <$> arbitrary
prop_foo (Small x) (Small y) = x /= y ==> ...
Cheers, Simon