Search in sources :

Example 21 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testNotBelonging.

@Test
public void testNotBelonging() {
    String formula = "1 /: {2,3}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 22 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testStrictSubset.

@Test
public void testStrictSubset() {
    String formula = "{1} <<: {1,2}";
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 23 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testSetExtensionFormulaWithSetVarModel.

@Test
public void testSetExtensionFormulaWithSetVarModel() {
    String formula = "{1,2} = x";
    // getting the translated z3 representation of the formula
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    Expr x = z3Context.mkArrayConst("x", z3Context.mkIntSort(), z3Context.mkBoolSort());
    assertEquals(Status.SATISFIABLE, check);
    assertEquals("(store (store ((as const (Array Int Bool)) false) 1 true) 2 true)", 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)

Example 24 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testCartesianProduct.

@Test
public void testCartesianProduct() {
    String formula = "{1}*{2}={(1,2)}";
    // getting the translated z3 representation of the formula
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Example 25 with Status

use of su.litvak.chromecast.api.v2.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testFailAdditionFormula.

@Test
public void testFailAdditionFormula() {
    String formula = "x : 2 .. 3 & x > 3";
    // getting the translated z3 representation of the formula
    BoolExpr constraint = translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    assertEquals(Status.UNSATISFIABLE, check);
}
Also used : Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Test(org.junit.Test)

Aggregations

Status (com.microsoft.z3.Status)61 BoolExpr (com.microsoft.z3.BoolExpr)55 Test (org.junit.Test)48 Context (com.microsoft.z3.Context)11 Expr (com.microsoft.z3.Expr)10 Solver (com.microsoft.z3.Solver)6 Model (com.microsoft.z3.Model)4 BatfishException (org.batfish.common.BatfishException)4 HeaderSpace (org.batfish.datamodel.HeaderSpace)4 IpWildcard (org.batfish.datamodel.IpWildcard)4 Fixedpoint (com.microsoft.z3.Fixedpoint)3 Z3Exception (com.microsoft.z3.Z3Exception)3 MachineToZ3Translator (de.bmoth.backend.z3.MachineToZ3Translator)2 ModelCheckingResult (de.bmoth.modelchecker.ModelCheckingResult)2 State (de.bmoth.modelchecker.State)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Z3_ast_print_mode (com.microsoft.z3.enumerations.Z3_ast_print_mode)1 LitmusLexer (dartagnan.LitmusLexer)1 LitmusParser (dartagnan.LitmusParser)1