Sha256: 4de0586138c36a6a71c4e5a3d2c461b4b84dfab8ee61850b837051fdc19f6383

Contents?: true

Size: 1.47 KB

Versions: 29

Compression:

Stored size: 1.47 KB

Contents

module Tests exposing (..)

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")
        ]

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.52 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.51 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.50 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.49 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.48 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.47 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.46 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.45 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.44 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.43 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.42 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.41 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.40 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.39 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.38 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.37 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.36 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.34 tracks/elm/exercises/series/tests/Tests.elm
trackler-2.1.0.33 tracks/elm/exercises/series/tests/Tests.elm