Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void test_copy() {
- // for copy to work, the contents of the board need to be the same
- // but the actual references cannot be the same (i.e. we created a new
- // board in memory)
- SnakeBoard boardCopy = BOARD_START.copy();
- assertNotSame(BOARD_START, boardCopy);
- char[][] copyGrid = boardCopy.getGrid();
- char[][] origGrid = BOARD_START.getGrid();
- assertNotSame(origGrid, copyGrid);
- for (int row = 0; row < copyGrid.length; row++) {
- assertNotSame(origGrid[row], copyGrid[row]);
- for (int col = 0; col < copyGrid[row].length; col++) {
- assertEquals(origGrid[row][col], copyGrid[row][col]);
- }
- }
- }
- public static void main(String[] args) {
- System.out.println(BASIC.toString());
- System.out.println(BASIC_2.toString());
- System.out.println(BASIC_3.toString());
- System.out.println(BASIC_4.toString());
- System.out.println(BASIC_5.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement