def test_getNextAvailableSquare_AllAvailableRanksNoUnavailableSquare_returnsTheFirstRank(self): queenSolver = QueenSolver() availableRanks = deque ([1,2,3,4,5,6,7,8]) discardedRanks = list() possibleRank, square = queenSolver.getNextAvailableSquare(ord('A'), availableRanks , discardedRanks) self.assertEqual (possibleRank, 1) self.assertEqual (square, Square(ord('A'),1))
def test_getNextAvailableSquare_AllAvailableRanksNoUnavailableSquare_returnsTheFirstRank( self): queenSolver = QueenSolver() availableRanks = deque([1, 2, 3, 4, 5, 6, 7, 8]) discardedRanks = list() possibleRank, square = queenSolver.getNextAvailableSquare( ord('A'), availableRanks, discardedRanks) self.assertEqual(possibleRank, 1) self.assertEqual(square, Square(ord('A'), 1))
def test_getNextAvailableSquare_AllAvailableRanksFirstIsUnavailableSquare_returnsTheSecondRank(self): queenSolver = QueenSolver() availableRanks = deque ([1,2,3,4,5,6,7,8]) discardedRanks = list() queenSolver.addUnavailableSquare(Square(ord('A'),1)) possibleRank, square = queenSolver.getNextAvailableSquare(ord('A'), availableRanks , discardedRanks) self.assertEqual(len(availableRanks), 6) self.assertEqual(len(discardedRanks), 1) self.assertEqual(discardedRanks[0], 1) self.assertEqual (possibleRank, 2) self.assertEqual (square, Square(ord('A'),2))
def test_getNextAvailableSquare_AllAvailableRanksFirstIsUnavailableSquare_returnsTheSecondRank( self): queenSolver = QueenSolver() availableRanks = deque([1, 2, 3, 4, 5, 6, 7, 8]) discardedRanks = list() queenSolver.addUnavailableSquare(Square(ord('A'), 1)) possibleRank, square = queenSolver.getNextAvailableSquare( ord('A'), availableRanks, discardedRanks) self.assertEqual(len(availableRanks), 6) self.assertEqual(len(discardedRanks), 1) self.assertEqual(discardedRanks[0], 1) self.assertEqual(possibleRank, 2) self.assertEqual(square, Square(ord('A'), 2))