aboutsummaryrefslogtreecommitdiffstats
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
commit595530b7d6739cc011fc23c223bcf90a12b6ed18 (patch)
tree2b8bac63fca85118a706afea99eb76f190ad323e /tests
parent2f7d872c2c8777e28bad7bb9bf9baa8c4e20d9a0 (diff)
downloadxmonad-595530b7d6739cc011fc23c223bcf90a12b6ed18.tar.gz
xmonad-595530b7d6739cc011fc23c223bcf90a12b6ed18.tar.xz
xmonad-595530b7d6739cc011fc23c223bcf90a12b6ed18.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.gz
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