2016-08-17 11:14:17 +00:00
|
|
|
port module Main exposing (..)
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-08-17 11:14:17 +00:00
|
|
|
import Test.Runner.Node exposing (run)
|
|
|
|
import Json.Encode exposing (Value)
|
|
|
|
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"
|
|
|
|
[ test "[]] Accumulate" <|
|
|
|
|
\() -> 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
|
|
|
]
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-08-23 00:31:41 +00:00
|
|
|
main : Program Value
|
2016-05-13 02:26:52 +00:00
|
|
|
main =
|
2016-08-17 11:14:17 +00:00
|
|
|
run emit tests
|
|
|
|
|
|
|
|
|
|
|
|
port emit : ( String, Value ) -> Cmd msg
|