Sha256: 2417c75a3460da2ee4fb9641fa8098ffaf51facf8aadd1f72e4ebc443c73b4bb

Contents?: true

Size: 1.57 KB

Versions: 74

Compression:

Stored size: 1.57 KB

Contents

module Tests exposing (..)

import Dict exposing (Dict)
import Expect
import Test exposing (..)
import WordCount exposing (wordCount)


tests : Test
tests =
    describe "Word Count"
        [ test "count one word" <|
            \() ->
                Expect.equal [ ( "word", 1 ) ]
                    (wordCount "word" |> Dict.toList)
        , skip <|
            test "count one of each word" <|
                \() ->
                    Expect.equal [ ( "each", 1 ), ( "of", 1 ), ( "one", 1 ) ]
                        (wordCount "one of each" |> Dict.toList)
        , skip <|
            test "multiple occurrences of a word" <|
                \() ->
                    Expect.equal [ ( "blue", 1 ), ( "fish", 4 ), ( "one", 1 ), ( "red", 1 ), ( "two", 1 ) ]
                        (wordCount "one fish two fish red fish blue fish" |> Dict.toList)
        , skip <|
            test "ignore punctuation" <|
                \() ->
                    Expect.equal [ ( "as", 1 ), ( "car", 1 ), ( "carpet", 1 ), ( "java", 1 ), ( "javascript", 1 ) ]
                        (wordCount "car : carpet as java : javascript!!&@$%^&" |> Dict.toList)
        , skip <|
            test "include numbers" <|
                \() ->
                    Expect.equal [ ( "1", 1 ), ( "2", 1 ), ( "testing", 2 ) ]
                        (wordCount "testing, 1, 2 testing" |> Dict.toList)
        , skip <|
            test "normalize case" <|
                \() ->
                    Expect.equal [ ( "go", 3 ), ( "stop", 2 ) ]
                        (wordCount "go Go GO Stop stop" |> Dict.toList)
        ]

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.179 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.178 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.177 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.176 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.175 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.174 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.173 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.172 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.171 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.170 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.169 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.167 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.166 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.165 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.164 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.163 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.162 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.161 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.160 tracks/elm/exercises/word-count/tests/Tests.elm