Sha256: bb8374383c217e655676585e6a24486eb984f477af9b88541db692856bdc5b3a

Contents?: true

Size: 1.58 KB

Versions: 141

Compression:

Stored size: 1.58 KB

Contents

port module Main exposing (..)

import Test.Runner.Node exposing (run, TestProgram)
import Json.Encode exposing (Value)
import Test exposing (..)
import Expect
import RunLengthEncoding exposing (version, decode, encode)


tests : Test
tests =
    describe "RunLengthEncoding"
        [ test "the solution is for the correct version of the test" <|
            \() -> Expect.equal 2 version
        , test "encode simple" <|
            \() -> Expect.equal "2A3B4C" (encode "AABBBCCCC")
        , test "decode simple" <|
            \() -> Expect.equal "AABBBCCCC" (decode "2A3B4C")
        , test "encode with single values" <|
            \() ->
                Expect.equal "12WB12W3B24WB"
                    (encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB")
        , test "decode with single values" <|
            \() ->
                Expect.equal "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
                    (decode "12WB12W3B24WB")
        , test "(decode (encode (...)) combination" <|
            \() ->
                Expect.equal "zzz ZZ  zZ"
                    (decode (encode "zzz ZZ  zZ"))
        , test "decode with a x10 value" <|
            \() ->
                Expect.equal "WWWWWWWWWW"
                    (decode "10W")
        , test "encode unicode" <|
            \() -> Expect.equal "⏰3⚽2⭐⏰" (encode "⏰⚽⚽⚽⭐⭐⏰")
        , test "decode unicode" <|
            \() -> Expect.equal "⏰⚽⚽⚽⭐⭐⏰" (decode "⏰3⚽2⭐⏰")
        ]


main : TestProgram
main =
    run emit tests


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

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.1.0.3 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.1.0.2 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.1.0.1 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.1.0.0 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.55 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.54 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.53 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.52 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.51 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.50 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.49 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.48 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.47 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.46 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.45 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.44 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.43 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.42 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.41 tracks/elm/exercises/run-length-encoding/Tests.elm
trackler-2.0.8.40 tracks/elm/exercises/run-length-encoding/Tests.elm