2017-05-27 17:56:31 +00:00
|
|
|
module Tests exposing (..)
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-08-17 11:14:17 +00:00
|
|
|
import Test exposing (..)
|
|
|
|
import Expect
|
2016-03-17 01:38:35 +00:00
|
|
|
import Accumulate exposing (accumulate)
|
2015-09-12 20:38:29 +00:00
|
|
|
import String
|
|
|
|
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
square : Int -> Int
|
2016-03-17 01:38:51 +00:00
|
|
|
square x =
|
2016-06-19 21:46:13 +00:00
|
|
|
x * x
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
|
|
|
|
tests : Test
|
2016-03-17 01:38:51 +00:00
|
|
|
tests =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "Accumulate"
|
2017-05-11 17:57:34 +00:00
|
|
|
[ test "[] Accumulate" <|
|
2016-08-17 11:14:17 +00:00
|
|
|
\() -> Expect.equal [] (accumulate square [])
|
|
|
|
, test "square Accumulate" <|
|
|
|
|
\() -> Expect.equal [ 1, 4, 9 ] (accumulate square [ 1, 2, 3 ])
|
|
|
|
, test "toUpper Accumulate" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ "HELLO", "WORLD" ]
|
|
|
|
(accumulate String.toUpper [ "hello", "world" ])
|
|
|
|
, test "reverse Accumulate" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ "olleh", "dlrow" ]
|
|
|
|
(accumulate String.reverse [ "hello", "world" ])
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|