@@ -5,8 +5,6 @@ module QuickCheckUtils where
5import Control.Arrow (first)
5import Control.Arrow (first)
6import Data.Char (chr)
6import Data.Char (chr)
7import Data.Bits ((.&.))
7import Data.Bits ((.&.))
8−import Data.Int (Int64)
9−import Data.Word (Word8, Word16, Word32)
10import Data.String (IsString, fromString)
8import Data.String (IsString, fromString)
11import qualified Data.Text as T
9import qualified Data.Text as T
12import Data.Text.Foreign (I16)
10import Data.Text.Foreign (I16)
@@ -15,13 +13,6 @@ import System.Random (Random(..), RandomGen)
15import Test.QuickCheck hiding ((.&.))
13import Test.QuickCheck hiding ((.&.))
16import qualified Data.ByteString as B
14import qualified Data.ByteString as B
18−instance Random Int64 where
19− randomR = integralRandomR
20− random = randomR (minBound,maxBound)
22−instance Arbitrary Int64 where
23− arbitrary = choose (minBound,maxBound)
25instance Random I16 where
16instance Random I16 where
26 randomR = integralRandomR
17 randomR = integralRandomR
27 random = randomR (minBound,maxBound)
18 random = randomR (minBound,maxBound)
@@ -29,30 +20,9 @@ instance Random I16 where
29instance Arbitrary I16 where
20instance Arbitrary I16 where
30 arbitrary = choose (minBound,maxBound)
21 arbitrary = choose (minBound,maxBound)
32−instance Random Word8 where
33− randomR = integralRandomR
34− random = randomR (minBound,maxBound)
36−instance Arbitrary Word8 where
37− arbitrary = choose (minBound,maxBound)
39instance Arbitrary B.ByteString where
23instance Arbitrary B.ByteString where
40 arbitrary = B.pack `fmap` arbitrary
24 arbitrary = B.pack `fmap` arbitrary
42−instance Random Word16 where
43− randomR = integralRandomR
44− random = randomR (minBound,maxBound)
46−instance Arbitrary Word16 where
47− arbitrary = choose (minBound,maxBound)
49−instance Random Word32 where
50− randomR = integralRandomR
51− random = randomR (minBound,maxBound)
53−instance Arbitrary Word32 where
54− arbitrary = choose (minBound,maxBound)
56genUnicode :: IsString a => Gen a
26genUnicode :: IsString a => Gen a
57genUnicode = fmap fromString string where
27genUnicode = fmap fromString string where
58 string = sized $ \n ->
28 string = sized $ \n ->