forked from pierront/rock-paper-scissors
Compare commits
2 Commits
main
...
update-cod
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b88b8681c | |||
| 0a5f32c883 |
@@ -9,7 +9,7 @@ public enum Move {
|
|||||||
public boolean beats(Move other) {
|
public boolean beats(Move other) {
|
||||||
return switch (this) {
|
return switch (this) {
|
||||||
case ROCK -> other == SCISSORS;
|
case ROCK -> other == SCISSORS;
|
||||||
case PAPER -> other == ROCK || other == WELL;
|
case PAPER -> other == ROCK;
|
||||||
case SCISSORS -> other == PAPER;
|
case SCISSORS -> other == PAPER;
|
||||||
case WELL -> other == ROCK || other == SCISSORS;
|
case WELL -> other == ROCK || other == SCISSORS;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class MoveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_check_move_size(){
|
void should_check_move_size(){
|
||||||
Assertions.assertEquals(4, Move.values().length);
|
Assertions.assertEquals(3, Move.values().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest(name = "{0} should beat {1}")
|
@ParameterizedTest(name = "{0} should beat {1}")
|
||||||
@@ -35,8 +35,7 @@ class MoveTest {
|
|||||||
Arguments.of(Move.PAPER,Move.ROCK),
|
Arguments.of(Move.PAPER,Move.ROCK),
|
||||||
Arguments.of(Move.SCISSORS,Move.PAPER),
|
Arguments.of(Move.SCISSORS,Move.PAPER),
|
||||||
Arguments.of(Move.WELL,Move.ROCK),
|
Arguments.of(Move.WELL,Move.ROCK),
|
||||||
Arguments.of(Move.WELL,Move.SCISSORS),
|
Arguments.of(Move.WELL,Move.SCISSORS)
|
||||||
Arguments.of(Move.PAPER,Move.WELL)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user