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 <[email protected]>
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



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to