2016-08-17 11:14:17 +00:00
|
|
|
port module Main exposing (..)
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-12-17 19:28:59 +00:00
|
|
|
import Test.Runner.Node exposing (run, TestProgram)
|
2016-08-17 11:14:17 +00:00
|
|
|
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"
|
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
|
|
|
]
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2015-09-12 20:38:29 +00:00
|
|
|
|
2016-12-17 19:28:59 +00:00
|
|
|
main : TestProgram
|
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
|