Search in sources :

Example 36 with Expr

use of com.microsoft.z3.Expr in project bmoth by hhu-stups.

the class LiftsTest method testTargetAndCurrentCorrespond.

@Test
public void testTargetAndCurrentCorrespond() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "TargetAndCurrentCorrespond.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    Expr targetFloor = result.getLastState().getValues().get("target_floor");
    Expr currentFloor = result.getLastState().getValues().get("current_floor");
    assertNotEquals(targetFloor.toString(), currentFloor.toString());
}
Also used : Expr(com.microsoft.z3.Expr) MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 37 with Expr

use of com.microsoft.z3.Expr in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testSetMembership.

@Test
public void testSetMembership() {
    String formula = "x : {3}";
    // 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("3", z3Solver.getModel().eval(x, true).toString());
}
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)

Aggregations

BoolExpr (com.microsoft.z3.BoolExpr)28 Expr (com.microsoft.z3.Expr)27 Test (org.junit.Test)19 HashMap (java.util.HashMap)12 Status (com.microsoft.z3.Status)11 BitVecExpr (com.microsoft.z3.BitVecExpr)10 ArithExpr (com.microsoft.z3.ArithExpr)8 CommunityVar (org.batfish.symbolic.CommunityVar)6 State (de.bmoth.modelchecker.State)5 Ip (org.batfish.datamodel.Ip)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Map (java.util.Map)4 BatfishException (org.batfish.common.BatfishException)4 Prefix (org.batfish.datamodel.Prefix)4 BooleanExpr (org.batfish.datamodel.routing_policy.expr.BooleanExpr)4 Protocol (org.batfish.symbolic.Protocol)4 HashSet (java.util.HashSet)3 Collectors (java.util.stream.Collectors)3 MatchProtocol (org.batfish.datamodel.routing_policy.expr.MatchProtocol)3