Add direction tests for foldl and foldr in list-ops

This commit is contained in:
Arnau Siches 2016-08-12 06:29:28 +01:00
parent 8710ff3d3c
commit e3fc6ea2de
No known key found for this signature in database
GPG key ID: BDE9BB47690A7E17

View file

@ -27,10 +27,12 @@ tests =
, suite "foldl"
[ test "empty list" (assertEqual 0 (foldl (+) 0 []))
, test "non-empty list" (assertEqual 10 (foldl (+) 0 [1..4]))
, test "direction" (assertEqual [4,3,2,1] (foldl (::) [] [1..4]))
]
, suite "foldr"
[ test "empty list" (assertEqual 0 (foldr (+) 0 []))
, test "non-empty list" (assertEqual 10 (foldr (+) 0 [1..4]))
, test "direction" (assertEqual [1..4] (foldr (::) [] [1..4]))
]
, suite "append"
[ test "empty lists" (assertEqual [] (append [] []))