use of com.microsoft.z3.Expr in project batfish by batfish.
the class BoolExprTransformerTest method testVisitRangeMatchExpr.
@Test
public void testVisitRangeMatchExpr() {
BooleanExpr expr = RangeMatchExpr.fromSubRanges(BasicHeaderField.DSCP, BasicHeaderField.DSCP.getSize(), ImmutableSet.of(new SubRange(1, 3), new SubRange(5, 7)));
assertThat(toBoolExpr(expr, _input, _nodContext), instanceOf(BoolExpr.class));
}
use of com.microsoft.z3.Expr in project batfish by batfish.
the class Z3ContextJob method computeSmtConstraintsViaNod.
protected BoolExpr computeSmtConstraintsViaNod(NodProgram program, boolean negate) {
Fixedpoint fix = mkFixedpoint(program, true);
Expr answer = answerFixedPoint(fix, program);
return getSolverInput(answer, program, negate);
}
use of com.microsoft.z3.Expr in project bmoth by hhu-stups.
the class StateTest method testGetStateConstraint.
@Test
public void testGetStateConstraint() {
HashMap<String, Expr> map1 = new HashMap<>();
map1.put("x", z3Context.mkInt(11));
map1.put("y", z3Context.mkInt(12));
State state1 = new State(map1);
State state2 = new State(new HashMap<>());
assertEquals("(and (= x 11) (= y 12))", state1.getStateConstraint(z3Context).toString());
assertNull(state2.getStateConstraint(z3Context));
}
use of com.microsoft.z3.Expr in project bmoth by hhu-stups.
the class StateTest method testToString.
@Test
public void testToString() throws Exception {
HashMap<String, Expr> map = new HashMap<>();
map.put("z", z3Context.mkInt(13));
map.put("x", z3Context.mkInt(11));
map.put("y", z3Context.mkInt(12));
map.put("a", z3Context.mkInt(-200));
State state = new State(map);
assertEquals("{a=-200, x=11, y=12, z=13}", state.toString());
}
use of com.microsoft.z3.Expr in project bmoth by hhu-stups.
the class StateTest method testStateEquals.
@Test
public void testStateEquals() throws Exception {
HashMap<String, Expr> map1 = new HashMap<>();
HashMap<String, Expr> map2 = new HashMap<>();
map1.put("x", z3Context.mkInt(11));
map2.put("x", z3Context.mkInt(11));
State state1 = new State(map1);
State state2 = new State(map2);
assertEquals(state1, state2);
assertEquals(state1.hashCode(), state2.hashCode());
}
Aggregations