|
@ -80,6 +80,14 @@ class GameLogicTest { |
|
|
assertEquals(expectedResult, realResult); |
|
|
assertEquals(expectedResult, realResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "[{index}] {0}") |
|
|
|
|
|
@MethodSource("testCasesForCheckForWin") |
|
|
|
|
|
void checkForWinTest(String testName, boolean expectedResult, char[][] boardToCheck) { |
|
|
|
|
|
boolean realResult = new GameLogic(boardToCheck).checkForWin(); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals(expectedResult, realResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCountPlayfields() { |
|
|
private static Stream<Arguments> testCasesForCountPlayfields() { |
|
|
return Stream.of( |
|
|
return Stream.of( |
|
|
Arguments.of("1x1 board with too few fields", 1, 9), |
|
|
Arguments.of("1x1 board with too few fields", 1, 9), |
|
@ -123,5 +131,14 @@ class GameLogicTest { |
|
|
{'-', '-', '-'}}) |
|
|
{'-', '-', '-'}}) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCheckForWin() { |
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("check win for player 1", true, new char[][] |
|
|
|
|
|
{{'x', '-', '-'}, |
|
|
|
|
|
{'x', '-', '-'}, |
|
|
|
|
|
{'x', '-', '-'}}) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |