use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testFalseFormula.
@Test
public void testFalseFormula() throws Exception {
String formula = "x = FALSE";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
Expr x = z3Context.mkBoolConst("x");
assertEquals(SATISFIABLE, check);
assertEquals(z3Context.mkFalse(), z3Solver.getModel().eval(x, true));
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testImplication.
@Test
public void testImplication() throws Exception {
String formula = "1=1 => x";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
Expr x = z3Context.mkBoolConst("x");
assertEquals(SATISFIABLE, check);
assertEquals(z3Context.mkBool(true), z3Solver.getModel().eval(x, true));
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testTrueFormula.
@Test
public void testTrueFormula() throws Exception {
String formula = "x = TRUE";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
Expr x = z3Context.mkBoolConst("x");
assertEquals(SATISFIABLE, check);
assertEquals(z3Context.mkTrue(), z3Solver.getModel().eval(x, true));
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class QuantifiedFormulaEvaluationTest method testFailUniversalExistentialFormula.
@Test
public void testFailUniversalExistentialFormula() {
String formula = "#(y).(y:NATURAL & !(x).(x=y))";
// getting the translated z3 representation of the formula
BoolExpr constraint = translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.UNSATISFIABLE, check);
}
use of com.microsoft.z3.Status in project bmoth by hhu-stups.
the class QuantifiedFormulaEvaluationTest method testExistentialFormula.
@Test
public void testExistentialFormula() {
String formula = "#(x).(x=2)";
// getting the translated z3 representation of the formula
BoolExpr constraint = translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
assertEquals(Status.SATISFIABLE, check);
}
Aggregations