feat: dev-web - add deck and card tests (all are passed)

This commit is contained in:
kmitresse
2024-03-26 21:22:19 +01:00
parent d983f8ce97
commit f8e28d79ab
4 changed files with 128 additions and 15 deletions
@@ -61,4 +61,12 @@ public class Card {
public Value getValue() {
return value;
}
@Override
public String toString() {
return "Card{" +
"color=" + color +
", value=" + value +
'}';
}
}
@@ -65,7 +65,7 @@ public class Deck {
* @throws IllegalArgumentException si le nombre de couleurs ou de valeurs est incorrect
* @return un ensemble de cartes
*/
private static ArrayList<Card> createSetOfCard(int nbColors, int nbValues) throws IllegalArgumentException {
public static ArrayList<Card> createSetOfCard(int nbColors, int nbValues) throws IllegalArgumentException {
ArrayList<Card> cards = new ArrayList<>(nbColors*nbValues);
if (nbColors < 1 || nbColors > Card.Color.values().length) {
@@ -89,7 +89,7 @@ public class Deck {
* @param cards ensemble de cartes à mélanger
* @return un ensemble de cartes mélangées
*/
private static void shuffleSetOfCard(ArrayList<Card> cards) {
public static void shuffleSetOfCard(ArrayList<Card> cards) {
Collections.shuffle(cards);
}