Sha256: a2b8e9a43b51dfe055b77489912857f3b46e25df4e86c9d3beea731d45494f60

Contents?: true

Size: 1.57 KB

Versions: 114

Compression:

Stored size: 1.57 KB

Contents

module Tests exposing (..)

import Test exposing (..)
import Expect
import Dict exposing (Dict)
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

114 entries across 114 versions & 1 rubygems

Version Path
trackler-2.2.1.104 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.103 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.102 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.101 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.100 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.99 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.98 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.97 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.96 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.95 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.94 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.93 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.92 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.91 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.90 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.89 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.88 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.87 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.86 tracks/elm/exercises/word-count/tests/Tests.elm
trackler-2.2.1.85 tracks/elm/exercises/word-count/tests/Tests.elm