on master help sign in
Don't use Suite ctor explicitly and fix intentionally broken test
commit92d0b62311daae0c1083cc5565d0ac430740981c authorMax New <maxsnew@gmail.com> dateMon 28 Apr 2014, 10:55 (13 years ago) parent55dba13
7 files changed+23−23
tests/elm/Test.elm+1−1 tests/elm/Test/Array.elm+6−6 tests/elm/Test/Dict.elm+1−1 tests/elm/Test/List.elm+5−5 tests/elm/Test/Set.elm+3−3 tests/elm/Test/String.elm+5−5 tests/elm/Test/Trampoline.elm+2−2
tests/elm/Test.elm+1−1
@@ -17,7 +17,7 @@ import Test.String as String
1717import Test.Trampoline as Trampoline
1818
1919tests : Test
20−tests = Suite "Elm Standard Library Tests" [ List.tests,
20+tests = suite "Elm Standard Library Tests" [ List.tests,
2121 String.tests,
2222 Trampoline.tests,
2323 Array.tests,
tests/elm/Test/Array.elm+6−6
@@ -8,7 +8,7 @@ import ElmTest.Test (..)
88
99tests : Test
1010tests =
11− let creationTests = Suite "Creation"
11+ let creationTests = suite "Creation"
1212 [ test "empty" <| assertEqual Array.empty (Array.fromList [])
1313 , test "initialize" <| assertEqual (Array.initialize 4 id) (Array.fromList [0,1,2,3])
1414 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
@@ -20,13 +20,13 @@ tests =
2020 , test "repeat 3" <| assertEqual (Array.repeat 3 "cat") (Array.fromList ["cat","cat","cat"])
2121 , test "fromList" <| assertEqual (Array.fromList []) Array.empty
2222 ]
23− basicsTests = Suite "Basics"
23+ basicsTests = suite "Basics"
2424 [ test "length" <| assertEqual (Array.length (Array.fromList [1,2,3])) 3
2525 , test "length - Long" <| assertEqual (Array.length (Array.repeat 10000 0)) 10000
2626 , test "push" <| assertEqual (Array.push 3 (Array.fromList [1,2])) (Array.fromList [1,2,3])
2727 , test "append" <| assertEqual (Array.toList <| Array.append (Array.repeat 2 42) (Array.repeat 3 81)) ([42,42,81,81,81])
2828 ]
29− getAndSetTests = Suite "Get and Set"
29+ getAndSetTests = suite "Get and Set"
3030 [ test "get" <| assertEqual (Array.get 1 (Array.fromList [3,2,1])) (Just 2)
3131 , test "get 2" <| assertEqual (Array.get 5 (Array.fromList [3,2,1])) Nothing
3232 , test "get 3" <| assertEqual (Array.get -1 (Array.fromList [3,2,1])) Nothing
@@ -35,14 +35,14 @@ tests =
3535 , test "getOrFail" <| assertEqual (Array.getOrFail 2 (Array.fromList [3,2,1])) 1
3636 , test "set" <| assertEqual (Array.set 1 7 (Array.fromList [1,2,3])) (Array.fromList [1,7,3])
3737 ]
38− takingArraysApartTests = Suite "Taking Arrays Apart"
38+ takingArraysApartTests = suite "Taking Arrays Apart"
3939 [ test "toList" <| assertEqual (Array.toList (Array.fromList [3,5,8])) [3,5,8]
4040 , test "toIndexedList" <| assertEqual (Array.toIndexedList (Array.fromList ["cat","dog"])) [(0,"cat"), (1,"dog")]
4141 , test "slice" <| assertEqual (Array.slice 1 2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2])
4242 , test "slice 2" <| assertEqual (Array.slice 1 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2,3])
4343 , test "slice 3" <| assertEqual (Array.slice -3 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [2,3])
4444 ]
45− mappingAndFoldingTests = Suite "Mapping and Folding"
45+ mappingAndFoldingTests = suite "Mapping and Folding"
4646 [ test "map" <| assertEqual (Array.map sqrt (Array.fromList [1,4,9])) (Array.fromList [1,2,3])
4747 , test "indexedMap" <| assertEqual (Array.indexedMap (*) (Array.fromList [5,5,5])) (Array.fromList [0,5,10])
4848 , test "foldl" <| assertEqual (Array.foldl (::) [] (Array.fromList [1,2,3])) [3,2,1]
@@ -51,4 +51,4 @@ tests =
5151 , test "filter" <| assertEqual (Array.filter (\x -> x `mod` 2 == 0) (Array.fromList [1..6])) (Array.fromList [2,4,6])
5252 ]
5353 in
54− Suite "Array Tests" [creationTests, basicsTests, getAndSetTests, takingArraysApartTests, mappingAndFoldingTests]
54+ suite "Array Tests" [creationTests, basicsTests, getAndSetTests, takingArraysApartTests, mappingAndFoldingTests]
tests/elm/Test/Dict.elm+1−1
@@ -23,4 +23,4 @@ tests =
2323 , test "partition" <| assertEqual (Dict.singleton "Tom" "cat", Dict.singleton "Jerry" "mouse") (Dict.partition (\k v -> k == "Tom") animals)
2424 ]
2525 in
26− Suite "Dict Tests" <| List.concat [ getTests, filterTests ]
26+ suite "Dict Tests" <| List.concat [ getTests, filterTests ]
tests/elm/Test/List.elm+5−5
@@ -11,23 +11,23 @@ tests =
1111 let p1 = id
1212 p2 x = x < 3
1313 isEven n = n `mod` 2 == 0
14− in Suite "partition Tests" [ test "simple partition" <| assertEqual ([True],[False]) (List.partition p1 [False, True]),
14+ in suite "partition Tests" [ test "simple partition" <| assertEqual ([True],[False]) (List.partition p1 [False, True]),
1515 test "order check" <| assertEqual ([2,1], [5,6]) (List.partition p2 [2,5,6,1]),
16− test "partition doc check 1" <| assertEqual ([0,0,2], [3,4,5]) (partition p2 [0..5]),
16+ test "partition doc check 1" <| assertEqual ([0,1,2], [3,4,5]) (partition p2 [0..5]),
1717 test "partition doc check 2" <| assertEqual ([0,2,4], [1,3,5]) (partition isEven [0..5]),
1818 let n = 100000
1919 ts = repeat n True
2020 fs = repeat n False
2121 in test "partition stress test" <| assertEqual (ts, fs) (partition p1 (fs++ts))
2222 ]
23− unzipTests = Suite "unzip Tests" [
23+ unzipTests = suite "unzip Tests" [
2424 test "unzip doc check" <| assertEqual ([0,17,1337],[True,False,True]) (unzip [(0, True), (17, False), (1337, True)]),
2525 let n = 100000
2626 ts = repeat n True
2727 fs = repeat n False
2828 in test "unzip stress test" <| assertEqual (ts, fs) (unzip (zip ts fs))
2929 ]
30− intersperseTests = Suite "intersperse Tests" [
30+ intersperseTests = suite "intersperse Tests" [
3131 test "intersperse doc check" <| assertEqual ["turtles","on","turtles","on","turtles"] (intersperse "on" ["turtles","turtles","turtles"]),
3232 let n = 100000
3333 ts = repeat n True
@@ -35,4 +35,4 @@ tests =
3535 in test "intersperse stress test" <| assertEqual (tail . List.concat <| zipWith (\x y -> [x,y]) fs ts)
3636 (intersperse False ts)
3737 ]
38− in Suite "List Tests" [partitionTests, unzipTests, intersperseTests]
38+ in suite "List Tests" [partitionTests, unzipTests, intersperseTests]
tests/elm/Test/Set.elm+3−3
@@ -22,6 +22,6 @@ pred x = x <= 50
2222tests : Test
2323tests =
2424 let
25− filterTests = Suite "filter Tests" [test "Simple filter" <| assertEqual setPart1 <| Set.filter pred set]
26− partitionTests = Suite "partition Tests" [test "Simple partition" <| assertEqual (setPart1, setPart2) <| Set.partition pred set]
27− in Suite "Set Tests" [partitionTests, filterTests]
25+ filterTests = suite "filter Tests" [test "Simple filter" <| assertEqual setPart1 <| Set.filter pred set]
26+ partitionTests = suite "partition Tests" [test "Simple partition" <| assertEqual (setPart1, setPart2) <| Set.partition pred set]
27+ in suite "Set Tests" [partitionTests, filterTests]
tests/elm/Test/String.elm+5−5
@@ -8,27 +8,27 @@ import ElmTest.Test (..)
88
99tests : Test
1010tests =
11− let isEmptyTests = Suite "isEmpty Tests" [
11+ let isEmptyTests = suite "isEmpty Tests" [
1212 test "empty is empty" <| assert <| isEmpty "",
1313 test "not empty" <| assert <| not . isEmpty <| "the world"
1414 ]
1515 lengthTest = test "length of innumerable" <| assertEqual 11 (length "innumerable")
1616 reverseTest = test "reverse test" <| assertEqual "desserts" (reverse "stressed")
1717 repeatTest = test "repeat test" <| assertEqual "hahaha" (repeat 3 "ha")
18− unconsTests = Suite "uncons Tests" [
18+ unconsTests = suite "uncons Tests" [
1919 test "nonempty uncons" <| assertEqual (Just ('a',"bc")) (uncons "abc"),
2020 test "empty uncons" <| assertEqual Nothing (uncons "")
2121 ]
2222 appendTest = test "append test" <| assertEqual "butterfly" (append "butter" "fly")
2323 concatTest = test "concat test" <| assertEqual "nevertheless" (concat ["never","the","less"])
24− splitTests = Suite "split Tests" [
24+ splitTests = suite "split Tests" [
2525 test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow"),
2626 test "split slashes"<| assertEqual ["home","evan","Desktop", ""] (split "/" "home/evan/Desktop/")
2727 ]
28− joinTests = Suite "join Tests" [
28+ joinTests = suite "join Tests" [
2929 test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"]),
3030 test "join slashes" <| assertEqual "home/evan/Desktop" (join "/" ["home","evan","Desktop"])
3131 ]
3232
3333 endsWithTest = test "endsWith Check" (assert <| endsWith "h" "th")
34− in Suite "String Tests" [isEmptyTests, lengthTest, reverseTest, repeatTest, unconsTests, appendTest, concatTest, splitTests, joinTests, endsWithTest]
34+ in suite "String Tests" [isEmptyTests, lengthTest, reverseTest, repeatTest, unconsTests, appendTest, concatTest, splitTests, joinTests, endsWithTest]
tests/elm/Test/Trampoline.elm+2−2
@@ -24,6 +24,6 @@ goodSum n =
2424tests : Test
2525tests =
2626 let mkLoopCheck n = test ("Equivalent Loop Check #"++ show n) (assertEqual (badSum n) (goodSum n))
27− loopChecks = Suite "Equivalent to untrampolined Tests" <| map mkLoopCheck [0..25]
27+ loopChecks = suite "Equivalent to untrampolined Tests" <| map mkLoopCheck [0..25]
2828 noStackOverflow = test "Trampoline Deep Recursion Test" (assertEqual 500000500000 (goodSum 1000000))
29− in Suite "Trampoline Tests" [noStackOverflow, loopChecks]
29+ in suite "Trampoline Tests" [noStackOverflow, loopChecks]