Search in sources :

Example 16 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testSetExtensionFormulaWithSingleVarModel.

@Test
public void testSetExtensionFormulaWithSingleVarModel() {
    String formula = "{1,2} = {2,x}";
    // getting the translated z3 representation of the formula
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    Expr x = z3Context.mkIntConst("x");
    assertEquals(Status.SATISFIABLE, check);
    assertEquals(z3Context.mkInt(1), z3Solver.getModel().eval(x, true));
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) BoolExpr(com.microsoft.z3.BoolExpr) Expr(com.microsoft.z3.Expr) Test(org.junit.Test)

Example 17 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testIntersection.

@Test
public void testIntersection() {
    String formula = "{1,2} /\\ {2,3} = {2}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 18 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testUnion2.

@Test
public void testUnion2() {
    String formula = "{1,2} \\/ {2,3} = {1,2,3}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 19 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testDifference2.

@Test
public void testDifference2() {
    String formula = "{1,2}\\{3} = {1}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.UNSATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 20 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testNoProperSubset2.

@Test
public void testNoProperSubset2() {
    String formula = "{1} /<<: {1,2}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.UNSATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Aggregations

Status (com.microsoft.z3.Status)61 BoolExpr (com.microsoft.z3.BoolExpr)55 Test (org.junit.Test)48 Context (com.microsoft.z3.Context)11 Expr (com.microsoft.z3.Expr)10 Solver (com.microsoft.z3.Solver)6 Model (com.microsoft.z3.Model)4 BatfishException (org.batfish.common.BatfishException)4 HeaderSpace (org.batfish.datamodel.HeaderSpace)4 IpWildcard (org.batfish.datamodel.IpWildcard)4 Fixedpoint (com.microsoft.z3.Fixedpoint)3 Z3Exception (com.microsoft.z3.Z3Exception)3 MachineToZ3Translator (de.bmoth.backend.z3.MachineToZ3Translator)2 ModelCheckingResult (de.bmoth.modelchecker.ModelCheckingResult)2 State (de.bmoth.modelchecker.State)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Z3_ast_print_mode (com.microsoft.z3.enumerations.Z3_ast_print_mode)1 LitmusLexer (dartagnan.LitmusLexer)1 LitmusParser (dartagnan.LitmusParser)1