diff options
author | Alec Berryman <alec@thened.net> | 2007-04-19 12:46:52 +0200 |
---|---|---|
committer | Alec Berryman <alec@thened.net> | 2007-04-19 12:46:52 +0200 |
commit | 595530b7d6739cc011fc23c223bcf90a12b6ed18 (patch) | |
tree | 2b8bac63fca85118a706afea99eb76f190ad323e | |
parent | 2f7d872c2c8777e28bad7bb9bf9baa8c4e20d9a0 (diff) | |
download | xmonad-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
-rw-r--r-- | tests/Properties.hs | 8 |
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 |