Skip to content

Commit

Permalink
Merge pull request #322 from juhlig/update_autogenerated
Browse files Browse the repository at this point in the history
update all auto-generated exercises
  • Loading branch information
NobbZ committed Dec 19, 2018
2 parents fd8aa4b + 9366b0d commit 9d4250a
Show file tree
Hide file tree
Showing 25 changed files with 268 additions and 269 deletions.
2 changes: 2 additions & 0 deletions exercises/anagram/test/anagram_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
-include_lib("eunit/include/eunit.hrl").




'1_no_matches_test'() ->
?assertMatch([],
lists:sort(anagram:find_anagrams("diaper",
Expand Down
5 changes: 1 addition & 4 deletions exercises/bob/src/example.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-module(example).

-export([response/1, test_version/0]).
-export([response/1]).

-spec response(string()) -> string().
response(String) ->
Expand All @@ -12,9 +12,6 @@ response(String) ->
{fun is_question/1, "Sure."},
{fun (_) -> true end, "Whatever."}]).

test_version() ->
3.



first_match(S, [{F, Res} | Fs]) ->
Expand Down
52 changes: 27 additions & 25 deletions exercises/bob/test/bob_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,101 +8,103 @@
-include_lib("eunit/include/eunit.hrl").


stating_something_test() ->


'1_stating_something_test'() ->
?assertMatch("Whatever.",
bob:response("Tom-ay-to, tom-aaaah-to.")).

shouting_test() ->
'2_shouting_test'() ->
?assertMatch("Whoa, chill out!",
bob:response("WATCH OUT!")).

shouting_gibberish_test() ->
'3_shouting_gibberish_test'() ->
?assertMatch("Whoa, chill out!",
bob:response("FCECDFCAAB")).

asking_a_question_test() ->
'4_asking_a_question_test'() ->
?assertMatch("Sure.",
bob:response("Does this cryogenic chamber make me "
"look fat?")).

asking_a_numeric_question_test() ->
'5_asking_a_numeric_question_test'() ->
?assertMatch("Sure.",
bob:response("You are, what, like 15?")).

asking_gibberish_test() ->
'6_asking_gibberish_test'() ->
?assertMatch("Sure.", bob:response("fffbbcbeab?")).

talking_forcefully_test() ->
'7_talking_forcefully_test'() ->
?assertMatch("Whatever.",
bob:response("Let's go make out behind the gym!")).

using_acronyms_in_regular_speech_test() ->
'8_using_acronyms_in_regular_speech_test'() ->
?assertMatch("Whatever.",
bob:response("It's OK if you don't want to go to the "
"DMV.")).

forceful_question_test() ->
'9_forceful_question_test'() ->
?assertMatch("Calm down, I know what I'm doing!",
bob:response("WHAT THE HELL WERE YOU THINKING?")).

shouting_numbers_test() ->
'10_shouting_numbers_test'() ->
?assertMatch("Whoa, chill out!",
bob:response("1, 2, 3 GO!")).

no_letters_test() ->
'11_no_letters_test'() ->
?assertMatch("Whatever.", bob:response("1, 2, 3")).

question_with_no_letters_test() ->
'12_question_with_no_letters_test'() ->
?assertMatch("Sure.", bob:response("4?")).

shouting_with_special_characters_test() ->
'13_shouting_with_special_characters_test'() ->
?assertMatch("Whoa, chill out!",
bob:response("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")).

shouting_with_no_exclamation_mark_test() ->
'14_shouting_with_no_exclamation_mark_test'() ->
?assertMatch("Whoa, chill out!",
bob:response("I HATE THE DMV")).

statement_containing_question_mark_test() ->
'15_statement_containing_question_mark_test'() ->
?assertMatch("Whatever.",
bob:response("Ending with ? means a question.")).

non_letters_with_question_test() ->
'16_non_letters_with_question_test'() ->
?assertMatch("Sure.", bob:response(":) ?")).

prattling_on_test() ->
'17_prattling_on_test'() ->
?assertMatch("Sure.",
bob:response("Wait! Hang on. Are you going to be OK?")).

silence_test() ->
'18_silence_test'() ->
?assertMatch("Fine. Be that way!", bob:response([])).

prolonged_silence_test() ->
'19_prolonged_silence_test'() ->
?assertMatch("Fine. Be that way!",
bob:response(" ")).

alternate_silence_test() ->
'20_alternate_silence_test'() ->
?assertMatch("Fine. Be that way!",
bob:response("\t\t\t\t\t\t\t\t\t\t")).

multiple_line_question_test() ->
'21_multiple_line_question_test'() ->
?assertMatch("Whatever.",
bob:response("\nDoes this cryogenic chamber make me "
"look fat?\nNo.")).

starting_with_whitespace_test() ->
'22_starting_with_whitespace_test'() ->
?assertMatch("Whatever.",
bob:response(" hmmmmmmm...")).

ending_with_whitespace_test() ->
'23_ending_with_whitespace_test'() ->
?assertMatch("Sure.",
bob:response("Okay if like my spacebar quite a bit? ")).

other_whitespace_test() ->
'24_other_whitespace_test'() ->
?assertMatch("Fine. Be that way!",
bob:response("\n\r \t")).

non_question_ending_with_whitespace_test() ->
'25_non_question_ending_with_whitespace_test'() ->
?assertMatch("Whatever.",
bob:response("This is a statement ending with whitespace "
" ")).
36 changes: 19 additions & 17 deletions exercises/bracket-push/test/bracket_push_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,57 @@
-include_lib("eunit/include/eunit.hrl").


paired_square_brackets_test() ->


'1_paired_square_brackets_test'() ->
?assert(bracket_push:is_paired("[]")).

empty_string_test() ->
'2_empty_string_test'() ->
?assert(bracket_push:is_paired([])).

unpaired_brackets_test() ->
'3_unpaired_brackets_test'() ->
?assertNot(bracket_push:is_paired("[[")).

wrong_ordered_brackets_test() ->
'4_wrong_ordered_brackets_test'() ->
?assertNot(bracket_push:is_paired("}{")).

wrong_closing_bracket_test() ->
'5_wrong_closing_bracket_test'() ->
?assertNot(bracket_push:is_paired("{]")).

paired_with_whitespace_test() ->
'6_paired_with_whitespace_test'() ->
?assert(bracket_push:is_paired("{ }")).

partially_paired_brackets_test() ->
'7_partially_paired_brackets_test'() ->
?assertNot(bracket_push:is_paired("{[])")).

simple_nested_brackets_test() ->
'8_simple_nested_brackets_test'() ->
?assert(bracket_push:is_paired("{[]}")).

several_paired_brackets_test() ->
'9_several_paired_brackets_test'() ->
?assert(bracket_push:is_paired("{}[]")).

paired_and_nested_brackets_test() ->
'10_paired_and_nested_brackets_test'() ->
?assert(bracket_push:is_paired("([{}({}[])])")).

unopened_closing_brackets_test() ->
'11_unopened_closing_brackets_test'() ->
?assertNot(bracket_push:is_paired("{[)][]}")).

unpaired_and_nested_brackets_test() ->
'12_unpaired_and_nested_brackets_test'() ->
?assertNot(bracket_push:is_paired("([{])")).

paired_and_wrong_nested_brackets_test() ->
'13_paired_and_wrong_nested_brackets_test'() ->
?assertNot(bracket_push:is_paired("[({]})")).

paired_and_incomplete_brackets_test() ->
'14_paired_and_incomplete_brackets_test'() ->
?assertNot(bracket_push:is_paired("{}[")).

too_many_closing_brackets_test() ->
'15_too_many_closing_brackets_test'() ->
?assertNot(bracket_push:is_paired("[]]")).

math_expression_test() ->
'16_math_expression_test'() ->
?assert(bracket_push:is_paired("(((185 + 223.85) * 15) - 543)/2")).

complex_latex_expression_test() ->
'17_complex_latex_expression_test'() ->
?assert(bracket_push:is_paired("\\left(\\begin{array}{cc} \\frac{1}{3} "
"& x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\"
"right)")).
14 changes: 8 additions & 6 deletions exercises/collatz-conjecture/test/collatz_conjecture_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@
-include_lib("eunit/include/eunit.hrl").


zero_steps_for_one_test() ->


'1_zero_steps_for_one_test'() ->
?assertMatch(0, collatz_conjecture:steps(1)).

divide_if_even_test() ->
'2_divide_if_even_test'() ->
?assertMatch(4, collatz_conjecture:steps(16)).

even_and_odd_steps_test() ->
'3_even_and_odd_steps_test'() ->
?assertMatch(9, collatz_conjecture:steps(12)).

large_number_of_even_and_odd_steps_test() ->
'4_large_number_of_even_and_odd_steps_test'() ->
?assertMatch(152, collatz_conjecture:steps(1000000)).

zero_is_an_error_test() ->
'5_zero_is_an_error_test'() ->
?assertMatch({error,
"Only positive numbers are allowed"},
collatz_conjecture:steps(0)).

negative_value_is_an_error_test() ->
'6_negative_value_is_an_error_test'() ->
?assertMatch({error,
"Only positive numbers are allowed"},
collatz_conjecture:steps(-15)).

0 comments on commit 9d4250a

Please sign in to comment.