[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:48:43 UTC 2010


The following commit has been merged in the master branch:
commit 667a35920b6069b1b23f6bc573d0b069199162db
Author: John Goerzen <jgoerzen at complete.org>
Date:   Wed Dec 1 01:45:21 2004 +0100

    Updated tests
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-127)

diff --git a/ChangeLog b/ChangeLog
index 8346ce2..c3414a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-30 18:45:21 GMT	John Goerzen <jgoerzen at complete.org>	patch-127
+
+    Summary:
+      Updated tests
+    Revision:
+      missingh--head--0.5--patch-127
+
+
+    modified files:
+     ChangeLog testsrc/Bitstest.hs testsrc/FiniteMaptest.hs
+     testsrc/Listtest.hs testsrc/MIMETypestest.hs
+
+
 2004-11-30 18:38:47 GMT	John Goerzen <jgoerzen at complete.org>	patch-126
 
     Summary:
diff --git a/testsrc/Bitstest.hs b/testsrc/Bitstest.hs
index 944df72..dc4b1cb 100644
--- a/testsrc/Bitstest.hs
+++ b/testsrc/Bitstest.hs
@@ -22,29 +22,31 @@ import MissingH.Bits
 import Data.Word
 
 test_fromBytes =
-    let f :: [Word32] -> Word32 -> Assertion
-        f inp exp = exp @=? fromBytes inp in
-        do
-        f [] 0
-        f [0] 0
-        f [1] 1
-        f [0xff, 0] 0xff00
-        f [0x0, 0xff] 0xff
-        f [0x12, 0x34, 0x56, 0x78] 0x12345678
-        f [0xff, 0xff, 0xff, 0xff] 0xffffffff
-        f [0xff, 0, 0, 0] 0xff000000
+    let f :: [Word32] -> Word32 -> Test
+        f inp exp = TestCase $ exp @=? fromBytes inp in
+        [
+         f [] 0
+        ,f [0] 0
+        ,f [1] 1
+        ,f [0xff, 0] 0xff00
+        ,f [0x0, 0xff] 0xff
+        ,f [0x12, 0x34, 0x56, 0x78] 0x12345678
+        ,f [0xff, 0xff, 0xff, 0xff] 0xffffffff
+        ,f [0xff, 0, 0, 0] 0xff000000
+        ]
 
 test_getBytes =
-    let f :: Word32 -> [Word32] -> Assertion
-        f inp exp = exp @=? getBytes inp in
-        do
-        f 0 [0, 0, 0, 0]
-        f 0x1200 [0, 0, 0x12, 0]
-        f 0x0012 [0, 0, 0, 0x12]
-        f 0xffffffff [0xff, 0xff, 0xff, 0xff]
-        f 0x12345678 [0x12, 0x34, 0x56, 0x78]
-        f 0xf0000000 [0xf0, 0, 0, 0]
+    let f :: Word32 -> [Word32] -> Test
+        f inp exp = TestCase $ exp @=? getBytes inp in
+        [
+         f 0 [0, 0, 0, 0]
+        ,f 0x1200 [0, 0, 0x12, 0]
+        ,f 0x0012 [0, 0, 0, 0x12]
+        ,f 0xffffffff [0xff, 0xff, 0xff, 0xff]
+        ,f 0x12345678 [0x12, 0x34, 0x56, 0x78]
+        ,f 0xf0000000 [0xf0, 0, 0, 0]
+        ]
 
-tests = TestList [TestLabel "getBytes" (TestCase test_getBytes),
-                  TestLabel "fromBytes" (TestCase test_fromBytes)
+tests = TestList [TestLabel "getBytes" (TestList test_getBytes),
+                  TestLabel "fromBytes" (TestList test_fromBytes)
                  ]
\ No newline at end of file
diff --git a/testsrc/FiniteMaptest.hs b/testsrc/FiniteMaptest.hs
index 3f2ec77..31716d3 100644
--- a/testsrc/FiniteMaptest.hs
+++ b/testsrc/FiniteMaptest.hs
@@ -22,24 +22,26 @@ import MissingH.FiniteMap
 import Data.FiniteMap
 
 test_flipFM =
-    let f inp exp = (listToFM exp) @=? flipFM (listToFM inp) in
-        do
-        f ([]::[(Int,Int)]) ([]::[(Int,[Int])])
-        f [("a", "b")] [("b", ["a"])]
-        f [("a", "b"),
-           ("c", "b"),
-           ("d", "e"),
-           ("b", "b")] [("b", ["c", "b", "a"]),
-                        ("e", ["d"])]
+    let f inp exp = TestCase $ (listToFM exp) @=? flipFM (listToFM inp) in
+        [
+         f ([]::[(Int,Int)]) ([]::[(Int,[Int])])
+        ,f [("a", "b")] [("b", ["a"])]
+        ,f [("a", "b"),
+            ("c", "b"),
+            ("d", "e"),
+            ("b", "b")] [("b", ["c", "b", "a"]),
+                         ("e", ["d"])]
+        ]
 
 test_flippedLookupFM =
-    let f item inp exp = exp @=? flippedLookupFM (listToFM inp) item in
-        do
-        f 'a' ([]::[(Char, Char)]) []
-        f 'a' [("Test1", 'a'), ("Test2", 'b')] ["Test1"]
-        f 'a' [("Test1", 'b'), ("Test2", 'b')] []
-        f 'a' [("Test1", 'a'), ("Test2", 'a')] ["Test2", "Test1"]
+    let f item inp exp = TestCase $ exp @=? flippedLookupFM (listToFM inp) item in
+        [
+         f 'a' ([]::[(Char, Char)]) []
+        ,f 'a' [("Test1", 'a'), ("Test2", 'b')] ["Test1"]
+        ,f 'a' [("Test1", 'b'), ("Test2", 'b')] []
+        ,f 'a' [("Test1", 'a'), ("Test2", 'a')] ["Test2", "Test1"]
+        ]
 
-tests = TestList [TestLabel "flipFM" (TestCase test_flipFM),
-                  TestLabel "flippedLookupFM" (TestCase test_flippedLookupFM)
+tests = TestList [TestLabel "flipFM" (TestList test_flipFM),
+                  TestLabel "flippedLookupFM" (TestList test_flippedLookupFM)
                  ]
\ No newline at end of file
diff --git a/testsrc/Listtest.hs b/testsrc/Listtest.hs
index 2fe5cad..743c24a 100644
--- a/testsrc/Listtest.hs
+++ b/testsrc/Listtest.hs
@@ -21,130 +21,140 @@ import HUnit
 import MissingH.List
 
 test_delFromAL = 
-    let f :: [(String, Int)] -> [(String, Int)] -> Assertion
-        f inp exp = exp @=? (delFromAL inp "testkey") in
-        do
+    let f :: [(String, Int)] -> [(String, Int)] -> Test
+        f inp exp = TestCase $ exp @=? (delFromAL inp "testkey") in
+        [
                  f [] []
-                 f [("one", 1)] [("one", 1)]
-                 f [("1", 1), ("2", 2), ("testkey", 3)] [("1", 1), ("2", 2)]
-                 f [("testkey", 1)] []
-                 f [("testkey", 1), ("testkey", 2)] []
-                 f [("testkey", 1), ("2", 2), ("3", 3)] [("2", 2), ("3", 3)]
-                 f [("testkey", 1), ("2", 2), ("testkey", 3), ("4", 4)]
-                   [("2", 2), ("4", 4)]
+                 ,f [("one", 1)] [("one", 1)]
+                 ,f [("1", 1), ("2", 2), ("testkey", 3)] [("1", 1), ("2", 2)]
+                 ,f [("testkey", 1)] []
+                 ,f [("testkey", 1), ("testkey", 2)] []
+                 ,f [("testkey", 1), ("2", 2), ("3", 3)] [("2", 2), ("3", 3)]
+                 ,f [("testkey", 1), ("2", 2), ("testkey", 3), ("4", 4)]
+                    [("2", 2), ("4", 4)]
+        ]
 
 test_addToAL =
-    let f :: [(String, Int)] -> [(String, Int)] -> Assertion
-        f inp exp = exp @=? (addToAL inp "testkey" 101) in
-        do
-        f [] [("testkey", 101)]
-        f [("testkey", 5)] [("testkey", 101)]
-        f [("testkey", 5), ("testkey", 6)] [("testkey", 101)]
+    let f :: [(String, Int)] -> [(String, Int)] -> Test
+        f inp exp = TestCase $ exp @=? (addToAL inp "testkey" 101) in
+        [
+         f [] [("testkey", 101)]
+        ,f [("testkey", 5)] [("testkey", 101)]
+        ,f [("testkey", 5), ("testkey", 6)] [("testkey", 101)]
+        ]
 
 test_split =
-    let f delim inp exp = exp @=? split delim inp in
-        do
-        f "," "foo,bar,,baz," ["foo", "bar", "", "baz", ""]
-        f "ba" ",foo,bar,,baz," [",foo,","r,,","z,"]
-        f "," "" []
-        f "," "," ["", ""]
+    let f delim inp exp = TestCase $ exp @=? split delim inp in
+        [
+         f "," "foo,bar,,baz," ["foo", "bar", "", "baz", ""]
+        ,f "ba" ",foo,bar,,baz," [",foo,","r,,","z,"]
+        ,f "," "" []
+        ,f "," "," ["", ""]
+        ]
 
 test_join =
-    let f :: (Eq a, Show a) => [a] -> [[a]] -> [a] -> Assertion
-        f delim inp exp = exp @=? join delim inp in
-        do
-        f "|" ["foo", "bar", "baz"] "foo|bar|baz"
-        f "|" [] ""
-        f "|" ["foo"] "foo"
-        -- f 5 [[1, 2], [3, 4]] [1, 2, 5, 3, 4]
+    let f :: (Eq a, Show a) => [a] -> [[a]] -> [a] -> Test
+        f delim inp exp = TestCase $ exp @=? join delim inp in
+        [
+         f "|" ["foo", "bar", "baz"] "foo|bar|baz"
+        ,f "|" [] ""
+        ,f "|" ["foo"] "foo"
+         -- f 5 [[1, 2], [3, 4]] [1, 2, 5, 3, 4]
+        ]
 
 test_replace =
-    let f old new inp exp = exp @=? replace old new inp in
-        do
-        f "" "" "" ""
-        f "foo" "bar" "" ""
-        f "foo" "bar" "foo" "bar"
-        f "foo" "bar" "footestfoothisisabarfoo" "bartestbarthisisabarbar"
-        f "," ", " "1,2,3,4" "1, 2, 3, 4"
-        f "," "." "1,2,3,4" "1.2.3.4"
+    let f old new inp exp = TestCase $ exp @=? replace old new inp in
+        [
+         f "" "" "" ""
+        ,f "foo" "bar" "" ""
+        ,f "foo" "bar" "foo" "bar"
+        ,f "foo" "bar" "footestfoothisisabarfoo" "bartestbarthisisabarbar"
+        ,f "," ", " "1,2,3,4" "1, 2, 3, 4"
+        ,f "," "." "1,2,3,4" "1.2.3.4"
+        ]
 
 test_genericJoin =
-    let f delim inp exp = exp @=? genericJoin delim inp in
-        do
-        f ", " [1, 2, 3, 4] "1, 2, 3, 4"
-        f ", " ([] :: [Int]) ""
-        f "|" ["foo", "bar", "baz"] "\"foo\"|\"bar\"|\"baz\""
-        f ", " [5] "5"
+    let f delim inp exp = TestCase $ exp @=? genericJoin delim inp in
+        [
+         f ", " [1, 2, 3, 4] "1, 2, 3, 4"
+        ,f ", " ([] :: [Int]) ""
+        ,f "|" ["foo", "bar", "baz"] "\"foo\"|\"bar\"|\"baz\""
+        ,f ", " [5] "5"
+        ]
 
 test_flipAL =
-    let f inp exp = exp @=? flipAL inp in
-        do
-        f ([]::[(Int,Int)]) ([]::[(Int,[Int])])
-        f [("a", "b")] [("b", ["a"])]
-        f [("a", "b"),
-           ("c", "b"),
-           ("d", "e"),
-           ("b", "b")] [("b", ["b", "c", "a"]),
-                        ("e", ["d"])]
+    let f inp exp = TestCase $ exp @=? flipAL inp in
+        [
+         f ([]::[(Int,Int)]) ([]::[(Int,[Int])])
+        ,f [("a", "b")] [("b", ["a"])]
+        ,f [("a", "b"),
+            ("c", "b"),
+            ("d", "e"),
+            ("b", "b")] [("b", ["b", "c", "a"]),
+                         ("e", ["d"])]
+        ]
 
 test_trunc =
-    let f len inp exp = exp @=? take len inp in
-        do
-        f 2 "Hello" "He"
-        f 1 "Hello" "H"
-        f 0 "Hello" ""
-        f 2 "H" "H"
-        f 2 "" ""
-        f 2 [1, 2, 3, 4, 5] [1, 2]
-        f 10 "Hello" "Hello"
-        f 0 "" ""
-                      
+    let f len inp exp = TestCase $ exp @=? take len inp in
+        [
+         f 2 "Hello" "He"
+        ,f 1 "Hello" "H"
+        ,f 0 "Hello" ""
+        ,f 2 "H" "H"
+        ,f 2 "" ""
+        ,f 2 [1, 2, 3, 4, 5] [1, 2]
+        ,f 10 "Hello" "Hello"
+        ,f 0 "" ""
+        ]              
 
 test_contains =
-    let f msg sub testlist exp = assertEqual msg exp (contains sub testlist) in
-        do
-        f "t1" "Haskell" "I really like Haskell." True
-        f "t2" "" "Foo" True
-        f "t3" "" "" True
-        f "t4" "Hello" "" False
-        f "t5" "Haskell" "Haskell" True
-        f "t6" "Haskell" "1Haskell" True
-        f "t7" "Haskell" "Haskell1" True
-        f "t8" "Haskell" "Ocaml" False
-        f "t9" "Haskell" "OCamlasfasfasdfasfd" False
-        f "t10" "a" "Hello" False
-        f "t11" "e" "Hello" True
+    let f msg sub testlist exp = TestCase $ assertEqual msg exp (contains sub testlist) in
+        [
+         f "t1" "Haskell" "I really like Haskell." True
+        ,f "t2" "" "Foo" True
+        ,f "t3" "" "" True
+        ,f "t4" "Hello" "" False
+        ,f "t5" "Haskell" "Haskell" True
+        ,f "t6" "Haskell" "1Haskell" True
+        ,f "t7" "Haskell" "Haskell1" True
+        ,f "t8" "Haskell" "Ocaml" False
+        ,f "t9" "Haskell" "OCamlasfasfasdfasfd" False
+        ,f "t10" "a" "Hello" False
+        ,f "t11" "e" "Hello" True
+        ]
 
 test_elemRIndex =
-    let f item inp exp = exp @=? elemRIndex item inp in
-        do
-        f "foo" [] Nothing
-        f "foo" ["bar", "baz"] Nothing
-        f "foo" ["foo"] (Just 0)
-        f "foo" ["foo", "bar"] (Just 0)
-        f "foo" ["bar", "foo"] (Just 1)
-        f "foo" ["foo", "bar", "foo", "bar", "foo"] (Just 4)
-        f 'f' ['f', 'b', 'f', 'f', 'b'] (Just 3)
-        f 'f' ['b', 'b', 'f'] (Just 2)
+    let f item inp exp = TestCase $ exp @=? elemRIndex item inp in
+        [
+         f "foo" [] Nothing
+        ,f "foo" ["bar", "baz"] Nothing
+        ,f "foo" ["foo"] (Just 0)
+        ,f "foo" ["foo", "bar"] (Just 0)
+        ,f "foo" ["bar", "foo"] (Just 1)
+        ,f "foo" ["foo", "bar", "foo", "bar", "foo"] (Just 4)
+        ,f 'f' ['f', 'b', 'f', 'f', 'b'] (Just 3)
+        ,f 'f' ['b', 'b', 'f'] (Just 2)
+        ]
 
 test_alwaysElemRIndex =
-    let f item inp exp = exp @=? alwaysElemRIndex item inp in
-        do
-        f "foo" [] (-1)
-        f 'f' ['b', 'q'] (-1)
-        f 'f' ['f', 'b', 'f', 'f', 'b'] 3
-
-tests = TestList [TestLabel "delFromAL" (TestCase test_delFromAL),
-                  TestLabel "addToAL" (TestCase test_addToAL),
-                  TestLabel "split" (TestCase test_split),
-                  TestLabel "join" (TestCase test_join),
-                  TestLabel "genericJoin" (TestCase test_genericJoin),
-                  TestLabel "trunc" (TestCase test_trunc),
-                  TestLabel "flipAL" (TestCase test_flipAL),
-                  TestLabel "elemRIndex" (TestCase test_elemRIndex),
-                  TestLabel "alwaysElemRIndex" (TestCase test_alwaysElemRIndex),
-                  TestLabel "replace" (TestCase test_replace),
-                  TestLabel "contains" (TestCase test_contains)]
+    let f item inp exp = TestCase $ exp @=? alwaysElemRIndex item inp in
+        [
+         f "foo" [] (-1)
+        ,f 'f' ['b', 'q'] (-1)
+        ,f 'f' ['f', 'b', 'f', 'f', 'b'] 3
+        ]
+
+tests = TestList [TestLabel "delFromAL" (TestList test_delFromAL),
+                  TestLabel "addToAL" (TestList test_addToAL),
+                  TestLabel "split" (TestList test_split),
+                  TestLabel "join" (TestList test_join),
+                  TestLabel "genericJoin" (TestList test_genericJoin),
+                  TestLabel "trunc" (TestList test_trunc),
+                  TestLabel "flipAL" (TestList test_flipAL),
+                  TestLabel "elemRIndex" (TestList test_elemRIndex),
+                  TestLabel "alwaysElemRIndex" (TestList test_alwaysElemRIndex),
+                  TestLabel "replace" (TestList test_replace),
+                  TestLabel "contains" (TestList test_contains)]
 
 
 
diff --git a/testsrc/MIMETypestest.hs b/testsrc/MIMETypestest.hs
index 413294f..9b16bdc 100644
--- a/testsrc/MIMETypestest.hs
+++ b/testsrc/MIMETypestest.hs
@@ -42,32 +42,34 @@ test_readMIMETypes =
 
 
 test_guessAllExtensions =
-    let f strict inp exp = (sort exp) @=? sort (guessAllExtensions defaultmtd strict inp) in
-        do
-        f True "" []
-        f True "foo" []
-        f True "application/octet-stream" [".obj", ".so", ".bin", ".a", ".dll", ".exe", ".o"]
-        f True "text/plain" [".pl", ".ksh", ".bat", ".c", ".h", ".txt"]
-        f True "application/rtf" []
-        f False "application/rtf" [".rtf"]
+    let f strict inp exp = TestCase $ (sort exp) @=? sort (guessAllExtensions defaultmtd strict inp) in
+        [
+         f True "" []
+        ,f True "foo" []
+        ,f True "application/octet-stream" [".obj", ".so", ".bin", ".a", ".dll", ".exe", ".o"]
+        ,f True "text/plain" [".pl", ".ksh", ".bat", ".c", ".h", ".txt"]
+        ,f True "application/rtf" []
+        ,f False "application/rtf" [".rtf"]
+        ]
 
 test_guessType =
-    let f strict inp exp = exp @=? guessType defaultmtd strict inp in 
-        do
-        f True "" (Nothing, Nothing)
-        f True "foo" (Nothing, Nothing)
-        f True "foo.txt" (Just "text/plain", Nothing)
-        f True "foo.txt.gz" (Just "text/plain", Just "gzip")
-        f True "foo.txt.blah" (Nothing, Nothing)
-        f True "foo.tar" (Just "application/x-tar", Nothing)
-        f True "foo.tar.gz" (Just "application/x-tar", Just "gzip")
-        f True "foo.tgz" (Just "application/x-tar", Just "gzip")
-        f True "http://foo/test.dir/blah.rtf" (Nothing, Nothing)
-        f False "http://foo/test.dir/blah.rtf" (Just "application/rtf", Nothing)
-        f True "foo.pict" (Nothing, Nothing)
-        f False "foo.pict" (Just "image/pict", Nothing)
+    let f strict inp exp = TestCase $ exp @=? guessType defaultmtd strict inp in 
+         [
+            f True "" (Nothing, Nothing)
+           ,f True "foo" (Nothing, Nothing)
+           ,f True "foo.txt" (Just "text/plain", Nothing)
+           ,f True "foo.txt.gz" (Just "text/plain", Just "gzip")
+           ,f True "foo.txt.blah" (Nothing, Nothing)
+           ,f True "foo.tar" (Just "application/x-tar", Nothing)
+           ,f True "foo.tar.gz" (Just "application/x-tar", Just "gzip")
+           ,f True "foo.tgz" (Just "application/x-tar", Just "gzip")
+           ,f True "http://foo/test.dir/blah.rtf" (Nothing, Nothing)
+           ,f False "http://foo/test.dir/blah.rtf" (Just "application/rtf", Nothing)
+           ,f True "foo.pict" (Nothing, Nothing)
+           ,f False "foo.pict" (Just "image/pict", Nothing)
+           ]
 
-tests = TestList [TestLabel "guessType" (TestCase test_guessType),
-                  TestLabel "guessAllExtensions" (TestCase test_guessAllExtensions),
+tests = TestList [TestLabel "guessType" (TestList test_guessType),
+                  TestLabel "guessAllExtensions" (TestList test_guessAllExtensions),
                   TestLabel "readMIMETypes" (TestList test_readMIMETypes)
                  ]

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list