def testIsSolution(self): cnf = [[('x', False), ('y', True)], [('y', False), ('z', True)]] inst1 = {'x': True, 'y': True, 'z': True} self.assertTrue(sat.is_solution(cnf, inst1)) inst2 = {'x': False, 'y': True, 'z': True} self.assertTrue(sat.is_solution(cnf, inst2)) inst3 = {'x': True, 'y': False, 'z': True} self.assertFalse(sat.is_solution(cnf, inst3)) inst4 = dict() self.assertRaises(sat.SATSolverException, sat.is_solution, cnf, inst4)
def testSolveCNF5(self): cnf = [] res, cert = sat.solve_cnf(cnf) self.assertEqual(res, 'satisfiable') self.assertTrue(sat.is_solution(cnf, cert))
def testSolveCNF1(self): cnf = [[('x', False), ('y', True)], [('y', False), ('z', True)]] res, cert = sat.solve_cnf(cnf) self.assertEqual(res, 'satisfiable') self.assertTrue(sat.is_solution(cnf, cert))
def testSolveCNF5(self): cnf = [] res = sat.solve_cnf(cnf) self.assertTrue(sat.is_solution(cnf, res))
def testSolveCNF1(self): cnf = [[('x', False), ('y', True)], [('y', False), ('z', True)]] res = sat.solve_cnf(cnf) self.assertTrue(sat.is_solution(cnf, res))