@@ -0,0 +1,25 @@
1+module TestFastSet where
2+
3+import Data.Word (Word8)
4+import qualified Data.ParserCombinators.Attoparsec.FastSet as F
5+import System.Random (Random(..), RandomGen)
6+import Test.QuickCheck
7+
8+integralRandomR :: (Integral a, RandomGen g) => (a, a) -> g -> (a, g)
9+integralRandomR (a,b) g = case randomR (fromIntegral a :: Int,
10+ fromIntegral b :: Int) g
11+ of (x,g') -> (fromIntegral x, g')
12+
13+instance Random Word8 where
14+ randomR = integralRandomR
15+ random = randomR (minBound,maxBound)
16+
17+instance Arbitrary Word8 where
18+ arbitrary = choose (minBound, maxBound)
19+
20+prop_AllMembers s =
21+ let set = F.fromList s
22+ in all (`F.memberWord8` set) s
23+
24+main = do
25+ quickCheck prop_AllMembers