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.28 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.27 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.26 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.25 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.24 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.23 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.22 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.21 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.20 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.19 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.18 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.17 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.16 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.15 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.14 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.13 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.12 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.11 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.10 tracks/erlang/exercises/word-count/word_count_tests.erl
trackler-2.0.6.9 tracks/erlang/exercises/word-count/word_count_tests.erl