mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-16 09:05:28 +00:00
feat: dev-web - add deck and card tests (all are passed)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user