add test for bug #661
authorSimon Marlow <simonmar@microsoft.com>
Wed, 1 Feb 2006 13:07:20 +0000 (13:07 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 1 Feb 2006 13:07:20 +0000 (13:07 +0000)
testsuite/tests/ghc-regress/lib/Data.HashTable/Makefile [new file with mode: 0644]
testsuite/tests/ghc-regress/lib/Data.HashTable/all.T [new file with mode: 0644]
testsuite/tests/ghc-regress/lib/Data.HashTable/hash001.hs [new file with mode: 0644]

diff --git a/testsuite/tests/ghc-regress/lib/Data.HashTable/Makefile b/testsuite/tests/ghc-regress/lib/Data.HashTable/Makefile
new file mode 100644 (file)
index 0000000..1c39d1c
--- /dev/null
@@ -0,0 +1,3 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghc-regress/lib/Data.HashTable/all.T b/testsuite/tests/ghc-regress/lib/Data.HashTable/all.T
new file mode 100644 (file)
index 0000000..20b60f2
--- /dev/null
@@ -0,0 +1 @@
+test('hash001', normal, compile_and_run, [''])
diff --git a/testsuite/tests/ghc-regress/lib/Data.HashTable/hash001.hs b/testsuite/tests/ghc-regress/lib/Data.HashTable/hash001.hs
new file mode 100644 (file)
index 0000000..727f488
--- /dev/null
@@ -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