Download:
child 54:2e633dc02528
parent 52:d9139e36aa28
53:eab83bab5659
Anton Shestakov <engored@ya.ru>, Sat, 08 Mar 2014 23:45:03 +0900
Less typing less errors in tests.

2 файлов изменено, 22 вставок(+), 20 удалений(-) [+]
test/rps3_tests.erl file | annotate | diff | comparison | revisions
test/rps5_tests.erl file | annotate | diff | comparison | revisions
--- a/test/rps3_tests.erl Sat Mar 08 23:40:26 2014 +0900
+++ b/test/rps3_tests.erl Sat Mar 08 23:45:03 2014 +0900
@@ -1,18 +1,19 @@
-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])).
--- a/test/rps5_tests.erl Sat Mar 08 23:40:26 2014 +0900
+++ b/test/rps5_tests.erl Sat Mar 08 23:45:03 2014 +0900
@@ -1,18 +1,19 @@
-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])).