You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package Minesweeper;
import static org.junit.jupiter.api.Assertions.*;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource;
class MinesweeperGameTest {
@ParameterizedTest @MethodSource("testBombs") void testBombPlacement(int _playfieldSize, int _bombAmount) { MinesweeperGame m = new MinesweeperGame(_playfieldSize, _bombAmount); int bombCounter = 0; for(Cell[] row : m.playfield){ for (Cell c : row) { if(c.type == CellType.Bomb) { bombCounter++; } } } assertEquals(_bombAmount, bombCounter); }
private static Stream<Arguments> testBombs(){ return Stream.of( Arguments.of(8, 10), Arguments.of(8, 0), Arguments.of(4, 12), Arguments.of(10, 100), Arguments.of(5, 1) ); } }
|