From a5f44e785e0c166229edfa74381b12fcdd9df33b Mon Sep 17 00:00:00 2001
From: FrederickPi1969 <pixinyudeyouxiang@gmail.com>
Date: Mon, 8 Feb 2021 21:13:34 -0600
Subject: [PATCH] Add testcase for player declaring colo with Wild

---
 .../sp21-cs242-assignment1/PlayerTest.class   | Bin 2482 -> 3122 bytes
 src/Test/PlayerTest.java                      |  32 ++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/out/test/sp21-cs242-assignment1/PlayerTest.class b/out/test/sp21-cs242-assignment1/PlayerTest.class
index 014a5f9933fb477faa6762523256715174095f82..6b4f7d3b1bcc3e1fcf24f953480526d5c58666ff 100644
GIT binary patch
delta 1270
zcmZXT+fQ6o6vlshZf6*dmZ1eN5!+%Ra*2b9p~_g)0tyDINo$dKJq!nC=m;`%=*3#6
z-l(N&t>dl4m>3^Od}&H`h?3Yo8y_0|6EyLEFpc<~;m`z|lkC0rUTb~(TkCvlW&6sV
ziC_Qy`4=F~#mk99;Zl-UY+l7N#B-ioaJ<=qq4EB<;c4fnlbZK(`P5KwpROgtgoSG}
z$zenNtsw?0>l6>T$2~tbYm;Nz5Sh`1VaFzF-kF(7Ju^P-X1r25!2$9%uQ6jtPPyKQ
z<7KkWc;4-s&HG%oW*zhjxtXbSoYxKEf;*9*K+(dpnP<RISEW?N--tBC+_`xtUrca}
z;}$1u-tf6^3j(hc!&lATM$avJ&*q&IZlT}J<ekFi<FSlWm>B9eB#!0s6MezKuW?l8
za#wWUU`)-762ov(R!Y0^Z`xNemt}-_Q>*WW9h}l?Zv^lbC7s~3ydh4Oe~d1d{MZMm
z)!Iaydr7iW)-LX&nKrF^X;r)0RCFij<@sFEK4z~ll0tl&cZAg>|GT_LSdo*w&o&~;
ze4Yhf64el8&dBl^eG#zuK(=_<LBd%jESCR{r5eu3;gkPRJA4#S?Xdo;Qtjb(-99X;
zkLdXxJ)EYCN7<*ZkH;9~30`2o3hm=-p5ziw@tfj*=jkf#K`iC1-K2dfpxveDk3}&e
z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/PlayerTest.java
index 62be5d0..de27e2a 100644
--- a/src/Test/PlayerTest.java
+++ b/src/Test/PlayerTest.java
@@ -21,6 +21,7 @@ class PlayerTest {
 
     @Test
     /**
+     * Test 1
      * Test when a card is played, it goes to the discard pile
      * Run 100 times to cancel randomness
      */
@@ -46,6 +47,7 @@ class PlayerTest {
 
 
     /**
+     * Test 2
      * Test the situation where player choose to draw a card
      * Run 100 times to cancel randomness
      */
@@ -82,4 +84,34 @@ class PlayerTest {
         game.gameStart();
         assert(game.rounds == 7);
     }
+
+
+
+    /**
+     * Test 4
+     * Test when a player plays a wild card and declare the matchable color as "red",
+     * the game state (controlled by ruleController) is properly updated.
+     * Notice the declaration is hard-coded in stage assignment-1.0
+     */
+    @Test
+    void testPlayerDeclareColorWithWild() {
+        Game game = null;
+        Player player = null;
+        int wildCardID = -1;
+        boolean hasWild = false;
+        while (!hasWild) {
+            game = new Game(1);
+            player = game.players.get(0);
+            for (int cardID : player.getCards()) {
+                if (cardID >= 101 && cardID <= 104) {
+                    wildCardID = cardID;
+                    hasWild = true;
+                    break;  // the player has a wild card
+                }
+            }
+        }
+        player.optionPlayOwnedCard(wildCardID);
+        assert(game.ruler.getMatchableColor().equals("red"));
+    }
+
 }
\ No newline at end of file
-- 
GitLab