on master help sign in
Don't use Suite ctor explicitly and fix intentionally broken test
92d0b62Max New
tests/elm/Test.elm+1−1
@@ -17,7 +17,7 @@ import Test.String as String
17import Test.Trampoline as Trampoline
17import Test.Trampoline as Trampoline
18
18
19tests : Test
19tests : Test
20−tests = Suite "Elm Standard Library Tests" [ List.tests,
20+tests = suite "Elm Standard Library Tests" [ List.tests,
21 String.tests,
21 String.tests,
22 Trampoline.tests,
22 Trampoline.tests,
23 Array.tests,
23 Array.tests,
tests/elm/Test/Array.elm+6−6
@@ -8,7 +8,7 @@ import ElmTest.Test (..)
8
8
9tests : Test
9tests : Test
10tests =
10tests =
11− let creationTests = Suite "Creation"
11+ let creationTests = suite "Creation"
12 [ test "empty" <| assertEqual Array.empty (Array.fromList [])
12 [ test "empty" <| assertEqual Array.empty (Array.fromList [])
13 , test "initialize" <| assertEqual (Array.initialize 4 id) (Array.fromList [0,1,2,3])
13 , test "initialize" <| assertEqual (Array.initialize 4 id) (Array.fromList [0,1,2,3])
14 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
14 , test "initialize 2" <| assertEqual (Array.initialize 4 (\n -> n*n)) (Array.fromList [0,1,4,9])
@@ -20,13 +20,13 @@ tests =
20 , test "repeat 3" <| assertEqual (Array.repeat 3 "cat") (Array.fromList ["cat","cat","cat"])
20 , test "repeat 3" <| assertEqual (Array.repeat 3 "cat") (Array.fromList ["cat","cat","cat"])
21 , test "fromList" <| assertEqual (Array.fromList []) Array.empty
21 , test "fromList" <| assertEqual (Array.fromList []) Array.empty
22 ]
22 ]
23− basicsTests = Suite "Basics"
23+ basicsTests = suite "Basics"
24 [ test "length" <| assertEqual (Array.length (Array.fromList [1,2,3])) 3
24 [ test "length" <| assertEqual (Array.length (Array.fromList [1,2,3])) 3
25 , test "length - Long" <| assertEqual (Array.length (Array.repeat 10000 0)) 10000
25 , test "length - Long" <| assertEqual (Array.length (Array.repeat 10000 0)) 10000
26 , test "push" <| assertEqual (Array.push 3 (Array.fromList [1,2])) (Array.fromList [1,2,3])
26 , test "push" <| assertEqual (Array.push 3 (Array.fromList [1,2])) (Array.fromList [1,2,3])
27 , test "append" <| assertEqual (Array.toList <| Array.append (Array.repeat 2 42) (Array.repeat 3 81)) ([42,42,81,81,81])
27 , test "append" <| assertEqual (Array.toList <| Array.append (Array.repeat 2 42) (Array.repeat 3 81)) ([42,42,81,81,81])
28 ]
28 ]
29− getAndSetTests = Suite "Get and Set"
29+ getAndSetTests = suite "Get and Set"
30 [ test "get" <| assertEqual (Array.get 1 (Array.fromList [3,2,1])) (Just 2)
30 [ test "get" <| assertEqual (Array.get 1 (Array.fromList [3,2,1])) (Just 2)
31 , test "get 2" <| assertEqual (Array.get 5 (Array.fromList [3,2,1])) Nothing
31 , test "get 2" <| assertEqual (Array.get 5 (Array.fromList [3,2,1])) Nothing
32 , test "get 3" <| assertEqual (Array.get -1 (Array.fromList [3,2,1])) Nothing
32 , test "get 3" <| assertEqual (Array.get -1 (Array.fromList [3,2,1])) Nothing
@@ -35,14 +35,14 @@ tests =
35 , test "getOrFail" <| assertEqual (Array.getOrFail 2 (Array.fromList [3,2,1])) 1
35 , test "getOrFail" <| assertEqual (Array.getOrFail 2 (Array.fromList [3,2,1])) 1
36 , test "set" <| assertEqual (Array.set 1 7 (Array.fromList [1,2,3])) (Array.fromList [1,7,3])
36 , test "set" <| assertEqual (Array.set 1 7 (Array.fromList [1,2,3])) (Array.fromList [1,7,3])
37 ]
37 ]
38− takingArraysApartTests = Suite "Taking Arrays Apart"
38+ takingArraysApartTests = suite "Taking Arrays Apart"
39 [ test "toList" <| assertEqual (Array.toList (Array.fromList [3,5,8])) [3,5,8]
39 [ test "toList" <| assertEqual (Array.toList (Array.fromList [3,5,8])) [3,5,8]
40 , test "toIndexedList" <| assertEqual (Array.toIndexedList (Array.fromList ["cat","dog"])) [(0,"cat"), (1,"dog")]
40 , test "toIndexedList" <| assertEqual (Array.toIndexedList (Array.fromList ["cat","dog"])) [(0,"cat"), (1,"dog")]
41 , test "slice" <| assertEqual (Array.slice 1 2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2])
41 , test "slice" <| assertEqual (Array.slice 1 2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2])
42 , test "slice 2" <| assertEqual (Array.slice 1 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2,3])
42 , test "slice 2" <| assertEqual (Array.slice 1 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [1,2,3])
43 , test "slice 3" <| assertEqual (Array.slice -3 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [2,3])
43 , test "slice 3" <| assertEqual (Array.slice -3 -2 (Array.fromList [0,1,2,3,4])) (Array.fromList [2,3])
44 ]
44 ]
45− mappingAndFoldingTests = Suite "Mapping and Folding"
45+ mappingAndFoldingTests = suite "Mapping and Folding"
46 [ test "map" <| assertEqual (Array.map sqrt (Array.fromList [1,4,9])) (Array.fromList [1,2,3])
46 [ test "map" <| assertEqual (Array.map sqrt (Array.fromList [1,4,9])) (Array.fromList [1,2,3])
47 , test "indexedMap" <| assertEqual (Array.indexedMap (*) (Array.fromList [5,5,5])) (Array.fromList [0,5,10])
47 , test "indexedMap" <| assertEqual (Array.indexedMap (*) (Array.fromList [5,5,5])) (Array.fromList [0,5,10])
48 , test "foldl" <| assertEqual (Array.foldl (::) [] (Array.fromList [1,2,3])) [3,2,1]
48 , test "foldl" <| assertEqual (Array.foldl (::) [] (Array.fromList [1,2,3])) [3,2,1]
@@ -51,4 +51,4 @@ tests =
51 , test "filter" <| assertEqual (Array.filter (\x -> x `mod` 2 == 0) (Array.fromList [1..6])) (Array.fromList [2,4,6])
51 , test "filter" <| assertEqual (Array.filter (\x -> x `mod` 2 == 0) (Array.fromList [1..6])) (Array.fromList [2,4,6])
52 ]
52 ]
53 in
53 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 =
23 , test "partition" <| assertEqual (Dict.singleton "Tom" "cat", Dict.singleton "Jerry" "mouse") (Dict.partition (\k v -> k == "Tom") animals)
23 , test "partition" <| assertEqual (Dict.singleton "Tom" "cat", Dict.singleton "Jerry" "mouse") (Dict.partition (\k v -> k == "Tom") animals)
24 ]
24 ]
25 in
25 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 =
11 let p1 = id
11 let p1 = id
12 p2 x = x < 3
12 p2 x = x < 3
13 isEven n = n `mod` 2 == 0
13 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]),
15 test "order check" <| assertEqual ([2,1], [5,6]) (List.partition p2 [2,5,6,1]),
15 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]),
17 test "partition doc check 2" <| assertEqual ([0,2,4], [1,3,5]) (partition isEven [0..5]),
17 test "partition doc check 2" <| assertEqual ([0,2,4], [1,3,5]) (partition isEven [0..5]),
18 let n = 100000
18 let n = 100000
19 ts = repeat n True
19 ts = repeat n True
20 fs = repeat n False
20 fs = repeat n False
21 in test "partition stress test" <| assertEqual (ts, fs) (partition p1 (fs++ts))
21 in test "partition stress test" <| assertEqual (ts, fs) (partition p1 (fs++ts))
22 ]
22 ]
23− unzipTests = Suite "unzip Tests" [
23+ unzipTests = suite "unzip Tests" [
24 test "unzip doc check" <| assertEqual ([0,17,1337],[True,False,True]) (unzip [(0, True), (17, False), (1337, True)]),
24 test "unzip doc check" <| assertEqual ([0,17,1337],[True,False,True]) (unzip [(0, True), (17, False), (1337, True)]),
25 let n = 100000
25 let n = 100000
26 ts = repeat n True
26 ts = repeat n True
27 fs = repeat n False
27 fs = repeat n False
28 in test "unzip stress test" <| assertEqual (ts, fs) (unzip (zip ts fs))
28 in test "unzip stress test" <| assertEqual (ts, fs) (unzip (zip ts fs))
29 ]
29 ]
30− intersperseTests = Suite "intersperse Tests" [
30+ intersperseTests = suite "intersperse Tests" [
31 test "intersperse doc check" <| assertEqual ["turtles","on","turtles","on","turtles"] (intersperse "on" ["turtles","turtles","turtles"]),
31 test "intersperse doc check" <| assertEqual ["turtles","on","turtles","on","turtles"] (intersperse "on" ["turtles","turtles","turtles"]),
32 let n = 100000
32 let n = 100000
33 ts = repeat n True
33 ts = repeat n True
@@ -35,4 +35,4 @@ tests =
35 in test "intersperse stress test" <| assertEqual (tail . List.concat <| zipWith (\x y -> [x,y]) fs ts)
35 in test "intersperse stress test" <| assertEqual (tail . List.concat <| zipWith (\x y -> [x,y]) fs ts)
36 (intersperse False ts)
36 (intersperse False ts)
37 ]
37 ]
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
22tests : Test
22tests : Test
23tests =
23tests =
24 let
24 let
25− filterTests = Suite "filter Tests" [test "Simple filter" <| assertEqual setPart1 <| Set.filter pred set]
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]
26+ partitionTests = suite "partition Tests" [test "Simple partition" <| assertEqual (setPart1, setPart2) <| Set.partition pred set]
27− in Suite "Set Tests" [partitionTests, filterTests]
27+ in suite "Set Tests" [partitionTests, filterTests]
tests/elm/Test/String.elm+5−5
@@ -8,27 +8,27 @@ import ElmTest.Test (..)
8
8
9tests : Test
9tests : Test
10tests =
10tests =
11− let isEmptyTests = Suite "isEmpty Tests" [
11+ let isEmptyTests = suite "isEmpty Tests" [
12 test "empty is empty" <| assert <| isEmpty "",
12 test "empty is empty" <| assert <| isEmpty "",
13 test "not empty" <| assert <| not . isEmpty <| "the world"
13 test "not empty" <| assert <| not . isEmpty <| "the world"
14 ]
14 ]
15 lengthTest = test "length of innumerable" <| assertEqual 11 (length "innumerable")
15 lengthTest = test "length of innumerable" <| assertEqual 11 (length "innumerable")
16 reverseTest = test "reverse test" <| assertEqual "desserts" (reverse "stressed")
16 reverseTest = test "reverse test" <| assertEqual "desserts" (reverse "stressed")
17 repeatTest = test "repeat test" <| assertEqual "hahaha" (repeat 3 "ha")
17 repeatTest = test "repeat test" <| assertEqual "hahaha" (repeat 3 "ha")
18− unconsTests = Suite "uncons Tests" [
18+ unconsTests = suite "uncons Tests" [
19 test "nonempty uncons" <| assertEqual (Just ('a',"bc")) (uncons "abc"),
19 test "nonempty uncons" <| assertEqual (Just ('a',"bc")) (uncons "abc"),
20 test "empty uncons" <| assertEqual Nothing (uncons "")
20 test "empty uncons" <| assertEqual Nothing (uncons "")
21 ]
21 ]
22 appendTest = test "append test" <| assertEqual "butterfly" (append "butter" "fly")
22 appendTest = test "append test" <| assertEqual "butterfly" (append "butter" "fly")
23 concatTest = test "concat test" <| assertEqual "nevertheless" (concat ["never","the","less"])
23 concatTest = test "concat test" <| assertEqual "nevertheless" (concat ["never","the","less"])
24− splitTests = Suite "split Tests" [
24+ splitTests = suite "split Tests" [
25 test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow"),
25 test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow"),
26 test "split slashes"<| assertEqual ["home","evan","Desktop", ""] (split "/" "home/evan/Desktop/")
26 test "split slashes"<| assertEqual ["home","evan","Desktop", ""] (split "/" "home/evan/Desktop/")
27 ]
27 ]
28− joinTests = Suite "join Tests" [
28+ joinTests = suite "join Tests" [
29 test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"]),
29 test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"]),
30 test "join slashes" <| assertEqual "home/evan/Desktop" (join "/" ["home","evan","Desktop"])
30 test "join slashes" <| assertEqual "home/evan/Desktop" (join "/" ["home","evan","Desktop"])
31 ]
31 ]
32
32
33 endsWithTest = test "endsWith Check" (assert <| endsWith "h" "th")
33 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 =
24tests : Test
24tests : Test
25tests =
25tests =
26 let mkLoopCheck n = test ("Equivalent Loop Check #"++ show n) (assertEqual (badSum n) (goodSum n))
26 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]
28 noStackOverflow = test "Trampoline Deep Recursion Test" (assertEqual 500000500000 (goodSum 1000000))
28 noStackOverflow = test "Trampoline Deep Recursion Test" (assertEqual 500000500000 (goodSum 1000000))
29− in Suite "Trampoline Tests" [noStackOverflow, loopChecks]
29+ in suite "Trampoline Tests" [noStackOverflow, loopChecks]