@@ -17,7 +17,6 @@ instance Random Int64 where
18instance Arbitrary Int64 where
18instance Arbitrary Int64 where
19 arbitrary = choose (minBound,maxBound)
19 arbitrary = choose (minBound,maxBound)
20− coarbitrary c = variant (fromEnum c `rem` 4)
22instance Random Word8 where
21instance Random Word8 where
23 randomR = integralRandomR
22 randomR = integralRandomR
@@ -25,11 +24,9 @@ instance Random Word8 where
26instance Arbitrary Word8 where
25instance Arbitrary Word8 where
27 arbitrary = choose (minBound,maxBound)
26 arbitrary = choose (minBound,maxBound)
28− coarbitrary c = variant (fromEnum c `rem` 4)
30instance Arbitrary B.ByteString where
28instance Arbitrary B.ByteString where
31 arbitrary = B.pack `fmap` arbitrary
29 arbitrary = B.pack `fmap` arbitrary
32− coarbitrary s = coarbitrary (B.unpack s)
34instance Random Word16 where
31instance Random Word16 where
35 randomR = integralRandomR
32 randomR = integralRandomR
@@ -37,7 +34,6 @@ instance Random Word16 where
38instance Arbitrary Word16 where
35instance Arbitrary Word16 where
39 arbitrary = choose (minBound,maxBound)
36 arbitrary = choose (minBound,maxBound)
40− coarbitrary c = variant (fromEnum c `rem` 4)
42instance Random Word32 where
38instance Random Word32 where
43 randomR = integralRandomR
39 randomR = integralRandomR
@@ -45,19 +41,12 @@ instance Random Word32 where
46instance Arbitrary Word32 where
42instance Arbitrary Word32 where
47 arbitrary = choose (minBound,maxBound)
43 arbitrary = choose (minBound,maxBound)
48− coarbitrary c = variant (fromEnum c `rem` 4)
50−instance Arbitrary Char where
51− arbitrary = oneof [choose ('\0','\55295'), choose ('\57344','\1114111')]
52− coarbitrary c = variant (fromEnum c `rem` 4)
54instance Arbitrary T.Text where
45instance Arbitrary T.Text where
55 arbitrary = T.pack `fmap` arbitrary
46 arbitrary = T.pack `fmap` arbitrary
56− coarbitrary s = coarbitrary (T.unpack s)
58instance Arbitrary TL.Text where
48instance Arbitrary TL.Text where
59 arbitrary = TL.pack `fmap` arbitrary
49 arbitrary = TL.pack `fmap` arbitrary
60− coarbitrary s = coarbitrary (TL.unpack s)
62newtype NotEmpty a = NotEmpty { notEmpty :: a }
51newtype NotEmpty a = NotEmpty { notEmpty :: a }
63 deriving (Eq, Ord, Show)
52 deriving (Eq, Ord, Show)
@@ -67,19 +56,15 @@ instance Functor NotEmpty where
68instance Arbitrary a => Arbitrary (NotEmpty [a]) where
57instance Arbitrary a => Arbitrary (NotEmpty [a]) where
69 arbitrary = sized (\n -> NotEmpty `fmap` (choose (1,n+1) >>= vector))
58 arbitrary = sized (\n -> NotEmpty `fmap` (choose (1,n+1) >>= vector))
70− coarbitrary = coarbitrary . notEmpty
72instance Arbitrary (NotEmpty T.Text) where
60instance Arbitrary (NotEmpty T.Text) where
73 arbitrary = (fmap T.pack) `fmap` arbitrary
61 arbitrary = (fmap T.pack) `fmap` arbitrary
74− coarbitrary = coarbitrary . notEmpty
76instance Arbitrary (NotEmpty TL.Text) where
63instance Arbitrary (NotEmpty TL.Text) where
77 arbitrary = (fmap TL.pack) `fmap` arbitrary
64 arbitrary = (fmap TL.pack) `fmap` arbitrary
78− coarbitrary = coarbitrary . notEmpty
80instance Arbitrary (NotEmpty B.ByteString) where
66instance Arbitrary (NotEmpty B.ByteString) where
81 arbitrary = (fmap B.pack) `fmap` arbitrary
67 arbitrary = (fmap B.pack) `fmap` arbitrary
82− coarbitrary = coarbitrary . notEmpty
84data Small = S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7
69data Small = S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7
85 | S8 | S9 | S10 | S11 | S12 | S13 | S14 | S15
70 | S8 | S9 | S10 | S11 | S12 | S13 | S14 | S15
@@ -120,7 +105,6 @@ instance Random Small where
121instance Arbitrary Small where
106instance Arbitrary Small where
122 arbitrary = choose (minBound,maxBound)
107 arbitrary = choose (minBound,maxBound)
123− coarbitrary c = variant (fromEnum c `rem` 4)
125integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
109integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
126integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,
110integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,