[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:43:11 UTC 2010
The following commit has been merged in the master branch:
commit 4f7b2592d6e55f3eaa0f2ea2ab145ffb80d12b41
Author: John Goerzen <jgoerzen at complete.org>
Date: Thu Oct 7 08:06:13 2004 +0100
Finished initial list tests
Keywords:
(jgoerzen at complete.org--projects/missingh--head--1.0--patch-37)
diff --git a/ChangeLog b/ChangeLog
index 36a149e..c44ca1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
#
+2004-10-07 02:06:13 GMT John Goerzen <jgoerzen at complete.org> patch-37
+
+ Summary:
+ Finished initial list tests
+ Revision:
+ missingh--head--1.0--patch-37
+
+
+ modified files:
+ ChangeLog testsrc/Listtest.hs
+
+
2004-10-07 01:47:55 GMT John Goerzen <jgoerzen at complete.org> patch-36
Summary:
diff --git a/testsrc/Listtest.hs b/testsrc/Listtest.hs
index b3a6623..f9d111e 100644
--- a/testsrc/Listtest.hs
+++ b/testsrc/Listtest.hs
@@ -33,7 +33,58 @@ test_delFromAL =
f [("testkey", 1), ("2", 2), ("testkey", 3), ("4", 4)]
[("2", 2), ("4", 4)]
-tests = TestList [TestLabel "delFromAL" (TestCase test_delFromAL)]
+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)]
+
+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 "," "," ["", ""]
+
+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]
+
+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"
+
+test_trunc =
+ let f len inp exp = exp @=? trunc 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 "" ""
+
+
+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)]
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list