public void testMultipleQueens() { XYLocation loc1 = new XYLocation(3, 3); board.addQueenAt(loc1); Assert.assertEquals(1, board.getNumberOfAttacksOn(loc1.right())); board.addQueenAt(loc1.right().right()); Assert.assertEquals(1, board.getNumberOfAttacksOn(loc1)); Assert.assertEquals(2, board.getNumberOfAttacksOn(loc1.right())); board.addQueenAt(loc1.right().down()); Assert.assertEquals(2, board.getNumberOfAttacksOn(loc1)); Assert.assertEquals(3, board.getNumberOfAttacksOn(loc1.right())); Assert .assertEquals(2, board.getNumberOfAttacksOn(loc1.right() .right())); }
public void testSimpleHorizontalAttack() { XYLocation loc = new XYLocation(0, 0); board.addQueenAt(loc); Assert.assertEquals(0, board.getNumberOfAttacksOn(loc)); Assert .assertEquals(1, board .getNumberOfAttacksOn(new XYLocation(1, 0))); Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.right())); Assert .assertEquals(1, board .getNumberOfAttacksOn(new XYLocation(7, 0))); }