Sha256: 2f78d29815e2e4e9484cc088802c5a653d79f91b207e7696bf9317f98b18c9ad

Contents?: true

Size: 1.54 KB

Versions: 311

Compression:

Stored size: 1.54 KB

Contents

using Base.Test

include("word-count.jl")

@testset "no words" begin
    @test wordcount(" .\n,\t!^&*()~@#\$%{}[]:;'/<>") == Dict()
end

@testset "count one word" begin
    @test wordcount("word") == Dict("word" => 1)
end

@testset "count one of each word" begin
    @test wordcount("one of each") == Dict("one" => 1, "of" => 1, "each" => 1)
end

@testset "multiple occurrences of a word" begin
    @test wordcount("one fish two fish red fish blue fish") == Dict("one" => 1, "fish" => 4, "two" => 1, "red" => 1, "blue" => 1)
end

@testset "handles cramped lists" begin
    @test wordcount("one,two,three") == Dict("one" => 1, "two" => 1, "three" => 1)
end

@testset "handles expanded lists" begin
    @test wordcount("one,\ntwo,\nthree") == Dict("one" => 1, "two" => 1, "three" => 1)
end

@testset "ignore punctuation" begin
    @test wordcount("car: carpet as java: javascript!!&@\$%^&") == Dict("car" => 1, "carpet" => 1, "as" => 1, "java" => 1, "javascript" => 1)
end

@testset "include numbers" begin
    @test wordcount("testing, 1, 2 testing") == Dict("testing" => 2, "1" => 1, "2" => 1)
end

@testset "normalize case" begin
    @test wordcount("go Go GO Stop stop") == Dict("go" => 3, "stop" => 2)
end

@testset "with apostrophes" begin
    @test wordcount("First: don't laugh. Then: don't cry.") == Dict("first" => 1, "don't" => 2, "laugh" => 1, "then" => 1, "cry" => 1)
end

@testset "with quotations" begin
    @test wordcount("Joe can't tell between 'large' and large.") == Dict("joe" => 1, "can't" => 1, "tell" => 1, "between" => 1, "large" => 2, "and" => 1)
end

Version data entries

311 entries across 311 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.118 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.117 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.116 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.115 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.114 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.113 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.111 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.110 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.109 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.108 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.107 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.106 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.105 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.104 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.103 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.102 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.101 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.100 tracks/julia/exercises/word-count/runtests.jl
trackler-2.2.1.99 tracks/julia/exercises/word-count/runtests.jl