use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class IpSpaceBooleanExprTransformerTest method testVisitEmptyIpSpace.
@Test
public void testVisitEmptyIpSpace() {
BooleanExpr expr = EmptyIpSpace.INSTANCE.accept(SRC_IP_SPACE_BOOLEAN_EXPR_TRANSFORMER);
assertThat(expr, equalTo(FalseExpr.INSTANCE));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyAndExprPreserveUnalteredInstance.
/**
* Test that an unsimplifiable expression is unchanged by simplification.
*/
@Test
public void testSimplifyAndExprPreserveUnalteredInstance() {
BooleanExpr p1 = newAtom();
BooleanExpr p2 = newAtom();
AndExpr and = new AndExpr(of(p1, p2));
assertThat(simplifyBooleanExpr(and), sameInstance(and));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyAnd1.
/**
* Test that an AND node with a single child (other than TRUE or FALSE) simplifies to that child.
*/
@Test
public void testSimplifyAnd1() {
BooleanExpr p1 = newAtom();
AndExpr and = new AndExpr(of(p1));
assertThat(simplifyBooleanExpr(and), equalTo(p1));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyAndTrue.
/**
* Test that any TRUE children of an AND node are removed.
*/
@Test
public void testSimplifyAndTrue() {
BooleanExpr p1 = newAtom();
BooleanExpr p2 = newAtom();
AndExpr and = new AndExpr(of(TrueExpr.INSTANCE, p1, TrueExpr.INSTANCE, p2));
assertThat(simplifyBooleanExpr(and), equalTo(new AndExpr(of(p1, p2))));
}
use of org.batfish.z3.expr.BooleanExpr in project batfish by batfish.
the class SimplifierTest method testSimplifyIfAntecedentStaticallyConsequent.
/**
* Test that an IF with antecedent statically determinable to be TRUE simplifies to the
* consequent.
*/
@Test
public void testSimplifyIfAntecedentStaticallyConsequent() {
BooleanExpr p1 = newAtom();
assertThat(simplifyBooleanExpr(new IfExpr(TrueExpr.INSTANCE, p1)), equalTo(p1));
assertThat(simplifyBooleanExpr(new IfExpr(new NotExpr(new NotExpr(TrueExpr.INSTANCE)), p1)), equalTo(p1));
}
Aggregations