@@ -18,6 +18,7 @@ module Tests.QuickCheckUtils
18 , unsquare
18 , unsquare
19 , smallArbitrary
19 , smallArbitrary
21 , NotEmpty (..)
22 , NotEmpty (..)
23 , Small (..)
24 , Small (..)
@@ -37,6 +38,7 @@ module Tests.QuickCheckUtils
37 , write_read
38 , write_read
41+import Control.Applicative ((<$>))
40import Control.Arrow (first, (***))
42import Control.Arrow (first, (***))
41import Control.DeepSeq (NFData (..), deepseq)
43import Control.DeepSeq (NFData (..), deepseq)
42import Control.Exception (bracket)
44import Control.Exception (bracket)
@@ -160,6 +162,14 @@ instance Arbitrary TL.Text where
160 arbitrary = (TL.fromChunks . map notEmpty) `fmap` smallArbitrary
162 arbitrary = (TL.fromChunks . map notEmpty) `fmap` smallArbitrary
161 shrink = map TL.pack . shrink . TL.unpack
163 shrink = map TL.pack . shrink . TL.unpack
165+newtype BigInt = Big Integer
168+instance Arbitrary BigInt where
169+ arbitrary = choose (20::Int,200) >>= \e -> Big <$> choose (10^(e-1),10^e)
170+ shrink (Big a) = [Big (a `div` 2^(l-e)) | e <- shrink l]
171+ where l = truncate (log (fromIntegral a) / log 2 :: Double) :: Integer
163newtype NotEmpty a = NotEmpty { notEmpty :: a }
173newtype NotEmpty a = NotEmpty { notEmpty :: a }
164 deriving (Eq, Ord)
174 deriving (Eq, Ord)