summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlec Berryman <alec@thened.net>2007-04-19 12:46:52 +0200
committerAlec Berryman <alec@thened.net>2007-04-19 12:46:52 +0200
commit4d279c6093f03c276bf6696a26b84e5f617e2381 (patch)
tree2b8bac63fca85118a706afea99eb76f190ad323e /tests
parent5b8cea254be67a09e680b20493de8370bca1248e (diff)
downloadmetatile-4d279c6093f03c276bf6696a26b84e5f617e2381.tar
metatile-4d279c6093f03c276bf6696a26b84e5f617e2381.zip
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
Diffstat (limited to 'tests')
-rw-r--r--tests/Properties.hs8
1 files changed, 8 insertions, 0 deletions
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