def test_assign_false_if_cotradiction_met(self): norvig = Norvig(self.mtrxhandler) self.assertFalse( norvig._assign( self.grid, self.field, self.value_with_contradiction ) )
def test_eliminate_value_if_valid(self): norvig = Norvig(self.mtrxhandler) actual = norvig._eliminate( self.grid_possible_values, self.field, self.value_valid )[self.field] self.assertTrue(self.value_valid not in actual)
def test_eliminate_false_if_cotradiction_met(self): norvig = Norvig(self.mtrxhandler) self.assertFalse( norvig._eliminate( self.grid_contradiction, self.field, self.value_with_contradiction ) )
def test_assign_value_if_valid(self): norvig = Norvig(self.mtrxhandler) expected = self.value_valid actual = norvig._assign( self.grid_possible_values, self.field, self.value_valid )[self.field] self.assertEqual(expected, actual)
def test_solve_unsolvable_caseunsolvable(self): norvig = Norvig(self.mtrxhandler_unsolvable) self.assertEqual(None, norvig.solve())
def test_solve(self): norvig = Norvig(self.mtrxhandler) self.assertEqual( self.mtrxhandler_solved.first_matrix, norvig.solve().first_matrix )
def test_search(self): norvig = Norvig(self.mtrxhandler) self.assertEqual( self.grid_solved, norvig._search(self.grid_possible_values) )
def test_construct_possible_values_grid(self): norvig = Norvig(self.mtrxhandler) self.assertEqual( self.grid_possible_values, norvig._construct_possible_values_grid(self.grid) )
def test_convert_matrix_to_grid(self): norvig = Norvig(self.mtrxhandler) self.assertEqual(self.grid,norvig._to_grid())