Commits

Anton Shestakov committed eab83ba

Less typing less errors in tests.

Comments (0)

Files changed (2)

test/rps3_tests.erl

 -module(rps3_tests).
+-import(rps3, [get_hands/0, winning_hand/1, why/2]).
 -include_lib("eunit/include/eunit.hrl").
 
 get_hands_test() ->
-    ?assertEqual(3, length(rps3:get_hands())).
+    ?assertEqual(3, length(get_hands())).
 
 winning_hand_test() ->
-    ?assertEqual(paper,     rps3:winning_hand([rock, paper])),
-    ?assertEqual(scissors,  rps3:winning_hand([paper, scissors])),
-    ?assertEqual(rock,      rps3:winning_hand([scissors, rock])),
-    ?assertEqual(rock,      rps3:winning_hand([rock, rock, rock])),
-    ?assertEqual(undefined, rps3:winning_hand([rock, paper, scissors])),
-    ?assertEqual(paper,     rps3:winning_hand([rock, paper, paper])),
-    ?assertEqual(paper,     rps3:winning_hand([rock, rock, paper])).
+    ?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("crushes", rps3:why(rock, scissors)),
-    ?assertEqual("paper covers rock", rps3:why(paper, [rock])).
+    ?assertEqual("crushes", why(rock, scissors)),
+    ?assertEqual("paper covers rock", why(paper, [rock])).

test/rps5_tests.erl

 -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(rps5:get_hands())).
+    ?assertEqual(5, length(get_hands())).
 
 winning_hand_test() ->
-    ?assertEqual(paper,     rps5:winning_hand([rock, paper])),
-    ?assertEqual(scissors,  rps5:winning_hand([paper, scissors])),
-    ?assertEqual(rock,      rps5:winning_hand([scissors, rock])),
-    ?assertEqual(rock,      rps5:winning_hand([rock, rock, rock])),
-    ?assertEqual(undefined, rps5:winning_hand([rock, paper, scissors])),
-    ?assertEqual(paper,     rps5:winning_hand([rock, paper, paper])),
-    ?assertEqual(paper,     rps5:winning_hand([rock, rock, paper])).
+    ?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", rps5:why(spock, scissors)),
-    ?assertEqual("lizard poisons spock, eats paper", rps5:why(lizard, [spock, paper])).
+    ?assertEqual("smashes", why(spock, scissors)),
+    ?assertEqual("lizard poisons spock, eats paper", why(lizard, [spock, paper])).