Exemple #1
0
 @Test
 public void testRoomInitial() {
   assertEquals('H', board.GetRoomCellAt(1, 5).getRoomInitial());
   assertEquals('L', board.GetRoomCellAt(19, 24).getRoomInitial());
   assertEquals('D', board.GetRoomCellAt(0, 24).getRoomInitial());
   assertEquals('Z', board.GetRoomCellAt(16, 3).getRoomInitial());
   assertEquals('P', board.GetRoomCellAt(23, 8).getRoomInitial());
 }
Exemple #2
0
 @Test
 public void testNumberDoorways() {
   int numDoors = 0;
   int numCells = board.getNumColumns() * board.getNumRows();
   assertEquals(625, numCells);
   for (int i = 0; i < numCells; ++i) {
     BoardCell cell = board.getCellAt(i);
     if (cell.isDoorway()) ++numDoors;
   }
   assertEquals(12, numDoors);
 }
Exemple #3
0
 @Test
 public void testDoorDirection() {
   RoomCell room;
   room = board.GetRoomCellAt(7, 5);
   assertTrue(room.isDoorway());
   assertEquals(RoomCell.DoorDirection.DOWN, room.getDoorDirection());
   room = board.GetRoomCellAt(23, 22);
   assertTrue(room.isDoorway());
   assertEquals(RoomCell.DoorDirection.LEFT, room.getDoorDirection());
   room = board.GetRoomCellAt(14, 21);
   assertTrue(room.isDoorway());
   assertEquals(RoomCell.DoorDirection.RIGHT, room.getDoorDirection());
   room = board.GetRoomCellAt(14, 0);
   assertTrue(room.isDoorway());
   assertEquals(RoomCell.DoorDirection.UP, room.getDoorDirection());
 }
Exemple #4
0
 @Test
 public void testRooms() {
   Map<Character, String> rooms = board.getRooms();
   assertEquals(rooms.size(), NUM_ROOMS);
   assertEquals("Blackjack Room", rooms.get('H'));
   assertEquals("Games Room", rooms.get('G'));
   assertEquals("Bowling Alley", rooms.get('B'));
   assertEquals("Zoo", rooms.get('Z'));
 }
Exemple #5
0
 @Test
 public void testCalcIndex() {
   assertEquals(0, board.calcIndex(0, 0));
   assertEquals(25, board.calcIndex(1, 0));
   assertEquals(624, board.calcIndex(NUM_ROWS - 1, NUM_COLUMNS - 1));
   assertEquals(NUM_COLUMNS - 1, board.calcIndex(0, NUM_COLUMNS - 1));
   assertEquals(600, board.calcIndex(NUM_ROWS - 1, 0));
   assertEquals(312, board.calcIndex(12, 12));
   assertEquals(520, board.calcIndex(20, 20));
 }
Exemple #6
0
 @Test
 public void testBoardDimensions() {
   assertEquals(NUM_ROWS, board.getNumRows());
   assertEquals(NUM_COLUMNS, board.getNumColumns());
 }