From 4d279c6093f03c276bf6696a26b84e5f617e2381 Mon Sep 17 00:00:00 2001 From: Alec Berryman Date: Thu, 19 Apr 2007 12:46:52 +0200 Subject: Arbitrary Word64 for running tests on amd64 Copied from Arbitrary Word8; I don't understand the coarbitrary definition and the Word64 one may be erroneous, but Properties.hs now compiles and passes all tests. darcs-hash:20070419104652-39448-765063393aada90785e3160dcfb6c5cc43fb34f1 --- tests/Properties.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/Properties.hs b/tests/Properties.hs index c3d58b6..62d5ec6 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -193,6 +193,14 @@ instance Arbitrary Word8 where arbitrary = choose (minBound,maxBound) coarbitrary n = variant (fromIntegral ((fromIntegral n) `rem` 4)) +instance Random Word64 where + randomR = integralRandomR + random = randomR (minBound,maxBound) + +instance Arbitrary Word64 where + arbitrary = choose (minBound,maxBound) + coarbitrary n = variant (fromIntegral ((fromIntegral n) `rem` 4)) + integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g) integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer, fromIntegral b :: Integer) g of -- cgit v1.2.3