Browse Source

tictactoe: added test case to check end of game with win for player 2

tictactoe
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
3936ada743
  1. 1
      src/main/java/de/tims/tictactoe/GameLogic.java
  2. 6
      src/test/java/de/tims/tictactoe/GameLogicTest.java

1
src/main/java/de/tims/tictactoe/GameLogic.java

@ -90,6 +90,7 @@ public class GameLogic {
public boolean checkEndOfGame() {
if (checkForWin('x')) return true;
if (checkForWin('o')) return true;
return false;
}

6
src/test/java/de/tims/tictactoe/GameLogicTest.java

@ -230,7 +230,11 @@ class GameLogicTest {
Arguments.of("end of game with win for player 1", true, new char[][]
{{'x', 'o', 'x'},
{'x', 'x', 'o'},
{'x', 'o', 'o'}})
{'x', 'o', 'o'}}),
Arguments.of("end of game with win for player 2", true, new char[][]
{{'x', 'x', 'o'},
{'o', 'o', 'o'},
{'x', 'o', 'x'}})
);
}

Loading…
Cancel
Save