Sha256: 1b04a22f53696d5e66f4f394c6c19a1ef1c58972b2f1aa5f08aa28e74ca607d1

Contents?: true

Size: 1.64 KB

Versions: 38

Compression:

Stored size: 1.64 KB

Contents

port module Main exposing (..)

import Test.Runner.Node exposing (run)
import Json.Encode exposing (Value)
import Test exposing (..)
import Expect
import Series exposing (slices)


tests : Test
tests =
    describe "Series"
        [ test "slices of one" <|
            \() ->
                Expect.equal (Ok [ [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ] ])
                    (slices 1 "01234")
        , test "slices of two" <|
            \() ->
                Expect.equal (Ok [ [ 9, 7 ], [ 7, 8 ], [ 8, 6 ], [ 6, 7 ], [ 7, 5 ], [ 5, 6 ], [ 6, 4 ] ])
                    (slices 2 "97867564")
        , test "slices of three" <|
            \() ->
                Expect.equal (Ok [ [ 9, 7, 8 ], [ 7, 8, 6 ], [ 8, 6, 7 ], [ 6, 7, 5 ], [ 7, 5, 6 ], [ 5, 6, 4 ] ])
                    (slices 3 "97867564")
        , test "slices of four" <|
            \() ->
                Expect.equal (Ok [ [ 0, 1, 2, 3 ], [ 1, 2, 3, 4 ] ])
                    (slices 4 "01234")
        , test "slices of five" <|
            \() ->
                Expect.equal (Ok [ [ 0, 1, 2, 3, 4 ] ])
                    (slices 5 "01234")
        , test "overly long slice" <|
            \() ->
                Expect.equal (Ok [])
                    (slices 4 "012")
        , test "overly short slice" <|
            \() ->
                Expect.equal (Err ("Invalid size: 0"))
                    (slices 0 "01234")
        , test "input has non numbers" <|
            \() ->
                Expect.equal (Err "could not convert string 'a' to an Int")
                    (slices 2 "0123abc")
        ]


main : Program Value
main =
    run emit tests


port emit : ( String, Value ) -> Cmd msg

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
trackler-2.0.5.1 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.5.0 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.4.0 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.9 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.8 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.7 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.6 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.5 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.4 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.3 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.2 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.1 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.3.0 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.2.0 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.1.2 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.1.1 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.1.0 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.0.10 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.0.9 tracks/elm/exercises/series/SeriesTests.elm
trackler-2.0.0.8 tracks/elm/exercises/series/SeriesTests.elm