use of org.batfish.z3.expr.OrExpr in project batfish by batfish.
the class BoolExprTransformerTest method testVisitOrExpr.
@Test
public void testVisitOrExpr() {
BooleanExpr p1Batfish = newBooleanAtom();
BooleanExpr p2Batfish = newBooleanAtom();
BoolExpr p1Z3 = toBoolExpr(p1Batfish, _input, _nodContext);
BoolExpr p2Z3 = toBoolExpr(p2Batfish, _input, _nodContext);
assertThat(toBoolExpr(new OrExpr(of(p1Batfish, p2Batfish)), _input, _nodContext), equalTo(_ctx.mkOr(p1Z3, p2Z3)));
}
use of org.batfish.z3.expr.OrExpr in project batfish by batfish.
the class SimplifierTest method testChainedSimplifications.
/**
* Test that we keep simplifying until no more simplifications are possible.
*/
@Test
public void testChainedSimplifications() {
OrExpr or = new OrExpr(of(new OrExpr(of(new OrExpr(of())))));
assertThat(simplifyBooleanExpr(or), equalTo(FalseExpr.INSTANCE));
}
use of org.batfish.z3.expr.OrExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyOrFalse.
/**
* Test that any FALSE children of an OR node are removed.
*/
@Test
public void testSimplifyOrFalse() {
BooleanExpr p1 = newAtom();
BooleanExpr p2 = newAtom();
OrExpr and = new OrExpr(of(FalseExpr.INSTANCE, p1, FalseExpr.INSTANCE, p2));
assertThat(simplifyBooleanExpr(and), equalTo(new OrExpr(of(p1, p2))));
}
use of org.batfish.z3.expr.OrExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyEmptyOr.
/**
* Test that an empty OR node is simplified to false (the identity under OR).
*/
@Test
public void testSimplifyEmptyOr() {
OrExpr or = new OrExpr(of());
assertThat(simplifyBooleanExpr(or), equalTo(FalseExpr.INSTANCE));
}
use of org.batfish.z3.expr.OrExpr in project batfish by batfish.
the class DefaultTransitionGenerator method visitDropAcl.
@Override
public void visitDropAcl(DropAcl.State dropAcl) {
// CopyDropAclIn
_rules.add(new BasicRuleStatement(DropAclIn.INSTANCE, DropAcl.INSTANCE));
// CopyDropAclOut
_rules.add(new BasicRuleStatement(DropAclOut.INSTANCE, DropAcl.INSTANCE));
// ProjectNodeDropAcl (unused for now)
// _rules.add(
// new RuleStatement(
// new OrExpr(
// _input
// .getEnabledNodes()
// .keySet()
// .stream()
// .map(NodeDropAcl::new)
// .collect(ImmutableList.toImmutableList())),
// DropAcl.INSTANCE));
}
Aggregations