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
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])
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)))
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)
def test_correct(self): assert self.instance.method == Method.SATISFY result = self.instance.solve() assert check_result(self.instance, result, self.other_solver)
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)