|
@ -12,23 +12,24 @@ import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
class MatchfieldCreationTest { |
|
|
class MatchfieldCreationTest { |
|
|
|
|
|
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(); |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void testMatchfieldCreateNotEmpty() { |
|
|
void testMatchfieldCreateNotEmpty() { |
|
|
int[][] calcResult = matchfield.createMatchfield(0); |
|
|
|
|
|
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(0); |
|
|
|
|
|
int[][] calcResult = matchfield.createMatchfield(); |
|
|
assertNotNull(calcResult); |
|
|
assertNotNull(calcResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield creation has correct size") |
|
|
@ParameterizedTest(name = "matchfield creation has correct size") |
|
|
@MethodSource("testMatchfieldSize") |
|
|
@MethodSource("testMatchfieldSize") |
|
|
void testMatchfieldCreationHasCorrectSize(String testName, int size, int expectedResult) { |
|
|
void testMatchfieldCreationHasCorrectSize(String testName, int size, int expectedResult) { |
|
|
matchfield.createMatchfield(size); |
|
|
|
|
|
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(size); |
|
|
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
|
int calcResult = matchfield.getSize(); |
|
|
int calcResult = matchfield.getSize(); |
|
|
assertThat(calcResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
assertThat(calcResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static Stream<Arguments> testMatchfieldSize() { |
|
|
static Stream<Arguments> testMatchfieldSize() { |
|
|
return Stream.of(Arguments.of("field size 10x10", 10, 10)); |
|
|
|
|
|
|
|
|
return Stream.of(Arguments.of("field size 10x10", 10, 100), Arguments.of("field size 15x15", 15, 225)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |