[commit: base] master: Move hash001 to base/tests (878a8dc)
Ian Lynagh
igloo at earth.li
Sun Nov 20 01:12:31 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/878a8dc0a80b1a7e40fe33352af621a428293fdf
>---------------------------------------------------------------
commit 878a8dc0a80b1a7e40fe33352af621a428293fdf
Author: Ian Lynagh <igloo at earth.li>
Date: Sat Nov 19 23:13:30 2011 +0000
Move hash001 to base/tests
>---------------------------------------------------------------
tests/all.T | 1 +
tests/hash001.hs | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tests/all.T b/tests/all.T
index fdc34f7..e46fdb2 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -18,4 +18,5 @@ test('unicode002',
[''])
test('data-fixed-show-read', normal, compile_and_run, [''])
test('showDouble', normal, compile_and_run, [''])
+test('hash001', normal, compile_and_run, [''])
diff --git a/tests/hash001.hs b/tests/hash001.hs
new file mode 100644
index 0000000..727f488
--- /dev/null
+++ b/tests/hash001.hs
@@ -0,0 +1,14 @@
+import Data.HashTable
+import qualified Data.HashTable as HT
+
+test :: Int -> IO ()
+test n = do ht <- new (==) hashInt
+ sequence_ [ insert ht key 0 | key <- [0..n]]
+ sequence_ [ insert ht key 1 | key <- [0..n]]
+
+ let check key = do (Just val) <- HT.lookup ht key
+ if val==1 then return () else putStrLn $ show key
+
+ sequence_ [ check key | key <- [0..n]]
+
+main = test 2048
More information about the Cvs-libraries
mailing list