use of de.bmoth.backend.z3.SolutionFinder in project bmoth by hhu-stups.
the class Issue73Test method testSatPredicateWithoutModel.
@Test
public void testSatPredicateWithoutModel() throws IOException {
String formula = "1 < 2";
BoolExpr constraint = translatePredicate(formula, z3Context);
SolutionFinder finder = new SolutionFinder(z3Solver, z3Context);
Set<Model> solutions = finder.findSolutions(constraint, 20);
assertEquals(0, solutions.size());
}
use of de.bmoth.backend.z3.SolutionFinder in project bmoth by hhu-stups.
the class FormulaEvaluationTest method testGreaterEqualFormula.
@Test
public void testGreaterEqualFormula() throws Exception {
String formula = "x >= 4 & x < 8";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
SolutionFinder finder = new SolutionFinder(z3Solver, z3Context);
Set<Model> solutions = finder.findSolutions(constraint, 20);
assertEquals(4, solutions.size());
for (Model solution : solutions) {
String solutionAsString = z3ModelToString(solution);
switch(solutionAsString) {
case "{x=4}":
case "{x=5}":
case "{x=6}":
case "{x=7}":
break;
default:
fail(solutionAsString + " is not part of found solutions");
}
}
}
use of de.bmoth.backend.z3.SolutionFinder in project bmoth by hhu-stups.
the class FormulaEvaluationTest method testLessEqualFormula.
@Test
public void testLessEqualFormula() throws Exception {
String formula = "x <= 4 & x > 0";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
SolutionFinder finder = new SolutionFinder(z3Solver, z3Context);
Set<Model> solutions = finder.findSolutions(constraint, 20);
assertEquals(4, solutions.size());
for (Model solution : solutions) {
String solutionAsString = z3ModelToString(solution);
switch(solutionAsString) {
case "{x=1}":
case "{x=2}":
case "{x=3}":
case "{x=4}":
break;
default:
fail(solutionAsString + " is not part of found solutions");
}
}
}
use of de.bmoth.backend.z3.SolutionFinder in project bmoth by hhu-stups.
the class SolutionFinderTest method setup.
@Before
@Override
public void setup() {
super.setup();
finder = new SolutionFinder(z3Solver, z3Context);
}
Aggregations