2016-08-17 11:14:17 +00:00
|
|
|
port module Main exposing (..)
|
2016-03-17 01:36:23 +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 SpaceAge exposing (Planet(..), ageOn)
|
2016-03-17 01:36:23 +00:00
|
|
|
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2016-03-17 01:36:23 +00:00
|
|
|
tests : Test
|
2016-03-17 01:38:51 +00:00
|
|
|
tests =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "SpaceAge"
|
|
|
|
[ test "age in earth years" <|
|
|
|
|
\() -> Expect.equal 32 (round (ageOn Earth 1000000000))
|
|
|
|
, test "age in mercury years" <|
|
|
|
|
\() -> Expect.equal 281 (round (ageOn Mercury 2134835688))
|
|
|
|
, test "age in venus years" <|
|
|
|
|
\() -> Expect.equal 10 (round (ageOn Venus 189839836))
|
|
|
|
, test "age on mars" <|
|
|
|
|
\() -> Expect.equal 39 (round (ageOn Mars 2329871239))
|
|
|
|
, test "age on jupiter" <|
|
|
|
|
\() -> Expect.equal 2 (round (ageOn Jupiter 901876382))
|
|
|
|
, test "age on saturn" <|
|
|
|
|
\() -> Expect.equal 3 (round (ageOn Saturn 3000000000))
|
|
|
|
, test "age on uranus" <|
|
|
|
|
\() -> Expect.equal 1 (round (ageOn Uranus 3210123456))
|
|
|
|
, test "age on neptune" <|
|
|
|
|
\() -> Expect.equal 2 (round (ageOn Neptune 8210123456))
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|
2016-03-17 01:36:23 +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
|