use of su.litvak.chromecast.api.v2.Status in project batfish by batfish.
the class NodJobTest method testNattedUnsat.
/**
* Test that traffic originating from 3.0.0.0 that is expected to be NATed returns UNSAT when we
* constrain to only allow NOT-NATed results.
*/
@Test
public void testNattedUnsat() {
HeaderSpace headerSpace = new HeaderSpace();
headerSpace.setSrcIps(ImmutableList.of(new IpWildcard("3.0.0.0")));
NodJob nodJob = getNodJob(headerSpace, false);
Context z3Context = new Context();
Status status = nodJob.computeNodSat(System.currentTimeMillis(), z3Context);
assertThat(status, equalTo(Status.UNSATISFIABLE));
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant.
@Test
public void testIssue59JustInvariant() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x & #x.({x} \\/ {1,2} = {1,2})";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant2.
@Test
public void testIssue59JustInvariant2() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class Issue76Test method testOperatorPrecedence.
@Test
public void testOperatorPrecedence() {
String satFormula1 = "TRUE or (FALSE & FALSE)";
String satFormula2 = "TRUE or FALSE & FALSE";
Status check;
BoolExpr satExpr1 = translatePredicate(satFormula1, z3Context);
BoolExpr satExpr2 = translatePredicate(satFormula2, z3Context);
z3Solver.add(satExpr1);
check = z3Solver.check();
assertEquals(Status.SATISFIABLE, check);
z3Solver.add(satExpr2);
check = z3Solver.check();
assertEquals(Status.UNSATISFIABLE, check);
}
use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.
the class BooleanFormulaEvaluationTest method testFalseFormula.
@Test
public void testFalseFormula() throws Exception {
String formula = "x = FALSE";
// getting the translated z3 representation of the formula
BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
z3Solver.add(constraint);
Status check = z3Solver.check();
Expr x = z3Context.mkBoolConst("x");
assertEquals(SATISFIABLE, check);
assertEquals(z3Context.mkFalse(), z3Solver.getModel().eval(x, true));
}
Aggregations