54:2e633dc02528 default tip
Anton Shestakov <engored@ya.ru>, Sat, 08 Mar 2014 23:46:38 +0900
Strictly speaking, rps_rules has no state.

previous change 53:eab83bab5659

test/rps5_tests.erl

Permissions: -rw-r--r--

Other formats: Feeds:
-module(rps5_tests).
-import(rps5, [get_hands/0, winning_hand/1, why/2]).
-include_lib("eunit/include/eunit.hrl").
get_hands_test() ->
?assertEqual(5, length(get_hands())).
winning_hand_test() ->
?assertEqual(paper, winning_hand([rock, paper])),
?assertEqual(scissors, winning_hand([paper, scissors])),
?assertEqual(rock, winning_hand([scissors, rock])),
?assertEqual(rock, winning_hand([rock, rock, rock])),
?assertEqual(undefined, winning_hand([rock, paper, scissors])),
?assertEqual(paper, winning_hand([rock, paper, paper])),
?assertEqual(paper, winning_hand([rock, rock, paper])).
why_test() ->
?assertEqual("smashes", why(spock, scissors)),
?assertEqual("lizard poisons spock, eats paper", why(lizard, [spock, paper])).