|
@ -33,7 +33,7 @@ class MatchfieldCreationTest { |
|
|
return Stream.of(Arguments.of("field size 10x10", 10, 100), Arguments.of("field size 15x15", 15, 225)); |
|
|
return Stream.of(Arguments.of("field size 10x10", 10, 100), Arguments.of("field size 15x15", 15, 225)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield change field is correct") |
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield get field is correct") |
|
|
@MethodSource("testMatchfieldGetFieldState") |
|
|
@MethodSource("testMatchfieldGetFieldState") |
|
|
void testMatchfieldGetCorrectState(String testName, int x, int y, int expectedResult) { |
|
|
void testMatchfieldGetCorrectState(String testName, int x, int y, int expectedResult) { |
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(10); |
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(10); |
|
@ -46,4 +46,20 @@ class MatchfieldCreationTest { |
|
|
static Stream<Arguments> testMatchfieldGetFieldState() { |
|
|
static Stream<Arguments> testMatchfieldGetFieldState() { |
|
|
return Stream.of(Arguments.of("field x:0 y:0 has initial state", 0, 0, 1)); |
|
|
return Stream.of(Arguments.of("field x:0 y:0 has initial state", 0, 0, 1)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield change field is correct") |
|
|
|
|
|
@MethodSource("testMatchfieldSetStateIsCorrect") |
|
|
|
|
|
void testMatchfieldGetCorrectState(String testName, int x, int y, int state, int expectedResult) { |
|
|
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(10); |
|
|
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
|
|
|
|
matchfield.setState(x, y, state); |
|
|
|
|
|
|
|
|
|
|
|
int calcResult = matchfield.getState(x, y); |
|
|
|
|
|
assertThat(calcResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> testMatchfieldSetStateIsCorrect() { |
|
|
|
|
|
return Stream.of(Arguments.of("field x:0 y:0 has state 2 after setState()", 0, 0, 2, 2)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |