示例#1
0
 def test(self, solver):
     """
     Checks that the result stored in this object, when given as data for the
     stored model with the given solver, is satisfied.
     """
     solver_instance = mzn.Solver.lookup(solver)
     passed = check_result(model=self.model,
                           result=self.result,
                           solver=solver_instance)
     return passed
示例#2
0
 def test_check_specific(self):
     assert self.instance.method == Method.SATISFY
     result = self.instance.solve(nr_solutions=5)
     assert check_result(self.instance, result, self.other_solver, [1, 2])
示例#3
0
 def test_check_all(self):
     assert self.instance.method == Method.SATISFY
     result = self.instance.solve(all_solutions=True)
     assert check_result(self.instance, result, self.other_solver,
                         range(len(result.solution)))
示例#4
0
 def test_incorrect(self):
     assert self.instance.method == Method.SATISFY
     result = self.instance.solve()
     result.solution = self.instance.output_type(x=[2, 1])
     assert not check_result(self.instance, result, self.other_solver)
示例#5
0
 def test_correct(self):
     assert self.instance.method == Method.SATISFY
     result = self.instance.solve()
     assert check_result(self.instance, result, self.other_solver)
示例#6
0
 def test_enum(self):
     self.instance.add_string("""enum Foo = {A, B};var Foo: f;""")
     result = self.instance.solve()
     assert check_result(self.instance, result, self.other_solver)