on master help sign in
Add (initially failing) stress tests for some list functions
commit42acdb1ac084497622bf35a7692a1a4ea04030f8 authorMax New <maxsnew@gmail.com> dateThu 24 Apr 2014, 14:51 (13 years ago) parent7c6a0d9
1 file changed+16−3
tests/elm/Test/List.elm+16−3
tests/elm/Test/List.elm+16−3
@@ -14,12 +14,25 @@ tests =
1414 in [ 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]),
1616 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
19+ ts = repeat n True
20+ fs = repeat n False
21+ in test "partition stress test" <| assertEqual (ts, fs) (partition p1 (fs++ts))
1822 ]
1923 unzipTests = [
20− 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 = 1000000
26+ ts = repeat n True
27+ fs = repeat n False
28+ in test "unzip stress test" <| assertEqual (ts, fs) (unzip (zip ts fs))
2129 ]
2230 intersperseTests = [
23− 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 = 1000000
33+ ts = repeat n True
34+ fs = repeat n False
35+ in test "intersperse stress test" <| assertEqual (tail . List.concat <| zipWith (\x y -> [x,y]) fs ts)
36+ (intersperse False ts)
2437 ]
2538 in List.concat [partitionTests, unzipTests, intersperseTests]