|
@ -88,6 +88,14 @@ class GameLogicTest { |
|
|
assertEquals(expectedResult, realResult); |
|
|
assertEquals(expectedResult, realResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "[{index}] {0}: should be {1}") |
|
|
|
|
|
@MethodSource("testCasesForCheckEndOfGame") |
|
|
|
|
|
void checkEndOfGameTest(String testName, boolean expectedResult, char[][] boardToCheck) { |
|
|
|
|
|
boolean realResult = new GameLogic(boardToCheck).checkEndOfGame(); |
|
|
|
|
|
|
|
|
|
|
|
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), |
|
@ -212,5 +220,14 @@ class GameLogicTest { |
|
|
{'o', 'x', 'x'}}) |
|
|
{'o', 'x', 'x'}}) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCheckEndOfGame() { |
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("check empty board", false, new char[][] |
|
|
|
|
|
{{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}}) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |