4 Commits
main ... Raban

Author SHA1 Message Date
a58c9c30ae Ajout Puit #3 2025-11-27 11:21:39 +01:00
d0e2476807 Ajout Puit #2 2025-11-27 11:11:11 +01:00
57d3bd7316 Ajout Puit 2025-11-27 11:03:06 +01:00
8a4d2ac01d Ajout Puit
All checks were successful
rock-paper-scissors/pipeline/pr-main This commit looks good
2025-11-27 10:54:36 +01:00
3 changed files with 12 additions and 5 deletions

View File

@@ -3,13 +3,15 @@ package fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.domain;
public enum Move {
ROCK,
PAPER,
SCISSORS;
SCISSORS,
WELL;
public boolean beats(Move other) {
return switch (this) {
case ROCK -> other == SCISSORS;
case PAPER -> other == ROCK;
case PAPER -> other == ROCK || other == WELL;
case SCISSORS -> other == PAPER;
case WELL -> other == ROCK || other ==SCISSORS;
};
}
}

View File

@@ -14,7 +14,7 @@ class MoveTest {
@Test
void should_check_move_size(){
Assertions.assertEquals(3, Move.values().length);
Assertions.assertEquals(4, Move.values().length);
}
@ParameterizedTest(name = "{0} should beat {1}")
@@ -33,7 +33,10 @@ class MoveTest {
return Stream.of(
Arguments.of(Move.ROCK,Move.SCISSORS),
Arguments.of(Move.PAPER,Move.ROCK),
Arguments.of(Move.SCISSORS,Move.PAPER)
Arguments.of(Move.PAPER,Move.WELL),
Arguments.of(Move.SCISSORS,Move.PAPER),
Arguments.of(Move.WELL,Move.ROCK),
Arguments.of(Move.WELL,Move.SCISSORS)
);
}
}

View File

@@ -4,6 +4,7 @@ import fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.domain.Move;
import fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.spi.RandomCpuPicker;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Set;
@@ -20,9 +21,10 @@ class RandomCpuPickerTest {
obtainedMoves.add(picker.pick());
}
assertEquals(3, obtainedMoves.size());
assertEquals(4, obtainedMoves.size());
assertTrue(obtainedMoves.contains(Move.ROCK));
assertTrue(obtainedMoves.contains(Move.PAPER));
assertTrue(obtainedMoves.contains(Move.SCISSORS));
assertTrue(obtainedMoves.contains(Move.WELL));
}
}