git.iko.soy/typeable/attoparsec
on 0.11.1.0 help sign in
typeable/attoparsec/tests/TestFastSet.hs
25 lines 719 B history raw
1module Main (main) where
3import Data.Word (Word8)
4import qualified Data.Attoparsec.FastSet as F
5import System.Random (Random(..), RandomGen)
6import Test.QuickCheck
8integralRandomR :: (Integral a, RandomGen g) => (a, a) -> g -> (a, g)
9integralRandomR (a,b) g = case randomR (fromIntegral a :: Int,
10 fromIntegral b :: Int) g
11 of (x,g') -> (fromIntegral x, g')
13instance Random Word8 where
14 randomR = integralRandomR
15 random = randomR (minBound,maxBound)
17instance Arbitrary Word8 where
18 arbitrary = choose (minBound, maxBound)
20prop_AllMembers s =
21 let set = F.fromList s
22 in all (`F.memberWord8` set) s
24main = do
25 quickCheck prop_AllMembers