Sha256: 9544ad2aaf99a1f5b5bc00f859f67c794ee1fdaf0a6c52b8d99f4d2a4c40e7d6

Contents?: true

Size: 1.3 KB

Versions: 84

Compression:

Stored size: 1.3 KB

Contents

-module(word_count_tests).
-include_lib("eunit/include/eunit.hrl").

%% dict should be used to implement wound_count:count/1.

count_one_word_test() ->
  assert_count(
    "word",
    [{"word", 1}]).

count_one_of_each_test() ->
  assert_count(
    "one of each",
    [{"one", 1},
     {"of", 1},
     {"each", 1}]).

count_multiple_occurrences_test() ->
  assert_count(
    "one fish two fish red fish blue fish",
    [{"one", 1},
     {"two", 1},
     {"fish", 4},
     {"red", 1},
     {"blue", 1}]).

ignore_punctuation_test() ->
  assert_count(
    "car : carpet as java : javascript!!&@$%^&",
    [{"car", 1},
     {"carpet", 1},
     {"as", 1},
     {"java", 1},
     {"javascript", 1}]).

include_numbers_test() ->
  assert_count(
    "testing, 1, 2 testing",
    [{"testing", 2},
     {"1", 1},
     {"2", 1}]).

normalize_case_test() ->
  assert_count(
    "go Go GO",
    [{"go", 3}]).

prefix_punctuation_test() ->
  assert_count(
    "!%%#testing, 1, 2 testing",
    [{"testing", 2},
     {"1", 1},
     {"2", 1}]).

symbols_are_separators_test() ->
  assert_count(
    "hey,my_spacebar_is_broken.",
    [{"hey", 1},
     {"my", 1},
     {"spacebar", 1},
     {"is", 1},
     {"broken", 1}]).

assert_count(S, Expect) ->
  ?assertEqual(orddict:from_list(Expect), orddict:from_list(dict:to_list(word_count:count(S)))).

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
trackler-2.0.6.8 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.7 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.6 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.5 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.4 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.3 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.2 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.1 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.0 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.18 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.17 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.16 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.15 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.14 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.13 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.12 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.11 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.10 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.9 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.5.8 tracks/erlang/exercises/word-count/word_count_tests.erl