Skip to content

Commit

Permalink
Test null in Data.Concurrent.HashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorycollins committed Aug 14, 2011
1 parent c3e58c8 commit 3e6ae43
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/suite/Data/Concurrent/HashMap/Tests.hs
Expand Up @@ -21,6 +21,7 @@ tests = [ testFromTo
, testLookup
, testDeletes
, testUpdate
, testNull
]


Expand All @@ -30,6 +31,21 @@ bogoHash "qqq" = 12345
bogoHash "zzz" = 12345
bogoHash x = H.hashBS x

testNull :: Test
testNull = testProperty "HashMap/null" $
monadicIO $ forAllM arbitrary prop
where
prop :: [(Int,Int)] -> PropertyM IO ()
prop l = do
pre $ not $ null l
ht <- run $ H.new H.hashInt
b <- run $ H.null ht
assert b

run $ mapM_ (\(k,v) -> H.insert k v ht) l
b' <- run $ H.null ht
assert $ not b'


testFromTo :: Test
testFromTo = testProperty "HashMap/fromList/toList" $
Expand Down

0 comments on commit 3e6ae43

Please sign in to comment.