class SolverTestCase(unittest.TestCase):
    def setUp(self):
        self.solver = Solver(9)
        self.puzzle = '0 9 4 0 0 0 1 3 0; 0 0 0 0 0 0 0 0 0; 0 0 0 0 7 6 0 0 2; 0 8 0 0 1 0 0 0 0; 0 3 2 0 0 0 0 0 0; 0 0 0 2 0 0 0 6 0; 0 0 0 0 5 0 4 0 0; 0 0 0 0 0 8 0 0 7; 0 0 6 3 0 4 0 0 8' 
        self.solver.board.set_puzzle(self.puzzle)
    
    def test_is_solution(self):# fix this test
        self.solver.board.empty_locations = 0
        assert self.solver.is_solution() == True
        self.solver.board.empty_locations = 1
        assert self.solver.is_solution() == False
        
    def test_local_count(self):
        test_location = (Location(2, 4))
        test_local_count = self.solver.local_count(test_location)
        assert test_local_count == 4, "local_count(%s) = %s" % (test_location, test_local_count)
        
    def test_next_location(self):
        next_location = self.solver.next_location()
        expected_location = Location(0, 3)
        assert expected_location == next_location

    def test_possible_numbers(self):
        test_location = Location(2,2)
        expected_possible_numbers = [1,3,5,8]
        possible_numbers = self.solver.possible_numbers(test_location)
        assert possible_numbers == expected_possible_numbers, "possible_numbers = %s" % possible_numbers
        
    def test_make_move(self):
        location = Location(2,2)
        number = 3
        self.solver.make_move(location, number)
        assert len(self.solver.moves) == 1
        assert self.solver.board.get_number(location) == number
        
    def test_solve(self):
        test_solution = matrix("7 9 4 5 8 2 1 3 6; 2 6 8 9 3 1 7 4 5; 3 1 5 4 7 6 9 8 2; 6 8 9 7 1 5 3 2 4; 4 3 2 8 6 9 5 7 1; 1 5 7 2 4 3 8 6 9; 8 2 1 6 5 7 4 9 3; 9 4 3 1 2 8 6 5 7; 5 7 6 3 9 4 2 1 8")
        self.solver.solve()
        (self.solver.solution == test_solution).all()
 def setUp(self):
     self.solver = Solver(9)
     self.puzzle = '0 9 4 0 0 0 1 3 0; 0 0 0 0 0 0 0 0 0; 0 0 0 0 7 6 0 0 2; 0 8 0 0 1 0 0 0 0; 0 3 2 0 0 0 0 0 0; 0 0 0 2 0 0 0 6 0; 0 0 0 0 5 0 4 0 0; 0 0 0 0 0 8 0 0 7; 0 0 6 3 0 4 0 0 8' 
     self.solver.board.set_puzzle(self.puzzle)