2016-05-13 02:26:52 +00:00
|
|
|
module Main exposing (..)
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-03-17 01:38:35 +00:00
|
|
|
import ElmTest exposing (..)
|
|
|
|
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 =
|
|
|
|
x * x
|
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
|
|
|
|
tests : Test
|
2016-03-17 01:38:51 +00:00
|
|
|
tests =
|
|
|
|
suite
|
|
|
|
"Accumulate"
|
|
|
|
[ test
|
|
|
|
"[]] Accumulate"
|
|
|
|
(assertEqual [] (accumulate square []))
|
|
|
|
, test
|
|
|
|
"square Accumulate"
|
|
|
|
(assertEqual [ 1, 4, 9 ] (accumulate square [ 1, 2, 3 ]))
|
|
|
|
, test
|
|
|
|
"toUpper Accumulate"
|
|
|
|
(assertEqual [ "HELLO", "WORLD" ] (accumulate String.toUpper [ "hello", "world" ]))
|
|
|
|
, test
|
|
|
|
"reverse Accumulate"
|
|
|
|
(assertEqual [ "olleh", "dlrow" ] (accumulate String.reverse [ "hello", "world" ]))
|
|
|
|
]
|
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-05-13 02:26:52 +00:00
|
|
|
main : Program Never
|
|
|
|
main =
|
|
|
|
runSuite tests
|