Sha256: f46d1c00898abf7e667fb794487d272cc5480f0e58dcc27dc35a2a831c17bec9

Contents?: true

Size: 1.6 KB

Versions: 172

Compression:

Stored size: 1.6 KB

Contents

-module(allergies_tests).

-define(TESTED_MODULE, (sut(allergies))).
-define(TEST_VERSION, 1).
-include("exercism.hrl").

no_allergies_at_all_test() ->
  ?assertEqual([], ?TESTED_MODULE:allergies(0)).

allergic_to_just_eggs_test() ->
  ?assertEqual(['eggs'], ?TESTED_MODULE:allergies(1)).

allergic_to_just_peanuts_test() ->
  ?assertEqual(['peanuts'], ?TESTED_MODULE:allergies(2)).

allergic_to_just_strawberries_test() ->
  ?assertEqual(['strawberries'], ?TESTED_MODULE:allergies(8)).

allergic_to_eggs_and_peanuts_test() ->
  ?assertEqual(['eggs', 'peanuts'], ?TESTED_MODULE:allergies(3)).

allergic_to_more_than_eggs_but_not_peanuts_test() ->
  ?assertEqual(['eggs', 'shellfish'], ?TESTED_MODULE:allergies(5)).

allergic_to_lots_of_stuff_test() ->
  ?assertEqual(
     ['strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats'], ?TESTED_MODULE:allergies(248)).

allergic_to_everything_test() ->
  ?assertEqual(
     ['eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats'],
     ?TESTED_MODULE:allergies(255)).

no_allergies_means_not_allergic_test() ->
  ?assertNot(?TESTED_MODULE:is_allergic_to('peanuts', 0)),
  ?assertNot(?TESTED_MODULE:is_allergic_to('cats', 0)),
  ?assertNot(?TESTED_MODULE:is_allergic_to('strawberries', 0)).

is_allergic_to_eggs_test() ->
  ?assert(?TESTED_MODULE:is_allergic_to('eggs', 1)).

allergic_to_eggs_and_other_stuff_test() ->
  ?assert(?TESTED_MODULE:is_allergic_to('eggs', 5)).

ignore_non_allergen_score_parts_test() ->
  ?assertEqual(
     ['eggs', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats'],
     ?TESTED_MODULE:allergies(509)).

Version data entries

172 entries across 172 versions & 1 rubygems

Version Path
trackler-2.2.1.62 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.61 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.60 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.59 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.58 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.57 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.56 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.55 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.54 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.53 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.52 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.51 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.50 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.49 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.48 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.47 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.46 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.45 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.44 tracks/erlang/exercises/allergies/test/allergies_tests.erl
trackler-2.2.1.43 tracks/erlang/exercises/allergies/test/allergies_tests.erl