Search in sources :

Example 26 with Status

use of org.geotoolkit.wps.xml.v200.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testStrictSubset.

@Test
public void testStrictSubset() {
    String formula = "{1} <<: {1,2}";
    BoolExpr constraint = FormulaToZ3Translator.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 27 with Status

use of org.geotoolkit.wps.xml.v200.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testBelonging.

@Test
public void testBelonging() {
    String formula = "1 : {1}";
    BoolExpr constraint = FormulaToZ3Translator.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 28 with Status

use of org.geotoolkit.wps.xml.v200.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testNoProperSubset2.

@Test
public void testNoProperSubset2() {
    String formula = "{1} /<<: {1,2}";
    BoolExpr constraint = FormulaToZ3Translator.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)

Example 29 with Status

use of org.geotoolkit.wps.xml.v200.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 = FormulaToZ3Translator.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 30 with Status

use of org.geotoolkit.wps.xml.v200.Status in project bmoth by hhu-stups.

the class SetFormulaEvaluationTest method testSetExtensionFormulaWithSingleVarModel.

@Test
public void testSetExtensionFormulaWithSingleVarModel() {
    String formula = "{1,2} = {2,x}";
    // getting the translated z3 representation of the formula
    BoolExpr constraint = FormulaToZ3Translator.translatePredicate(formula, z3Context);
    z3Solver.add(constraint);
    Status check = z3Solver.check();
    Expr x = z3Context.mkIntConst("x");
    assertEquals(Status.SATISFIABLE, check);
    assertEquals(z3Context.mkInt(1), z3Solver.getModel().eval(x, true));
}
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)

Aggregations

Status (com.microsoft.z3.Status)63 BoolExpr (com.microsoft.z3.BoolExpr)55 Test (org.junit.Test)49 Test (org.junit.jupiter.api.Test)17 IOException (java.io.IOException)11 Expr (com.microsoft.z3.Expr)10 JsonMapper.convertObjectToJsonString (com.arbindo.mimock.helpers.general.JsonMapper.convertObjectToJsonString)9 RandomDataGenerator.generateRandomAlphabeticString (com.arbindo.mimock.helpers.general.RandomDataGenerator.generateRandomAlphabeticString)9 Status (com.arbindo.mimock.manage.mimocks.models.v1.Status)9 Context (com.microsoft.z3.Context)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)9 Pageable (org.springframework.data.domain.Pageable)9 HttpStatus (org.springframework.http.HttpStatus)9 MvcResult (org.springframework.test.web.servlet.MvcResult)9 Mock (com.arbindo.mimock.entities.Mock)8 List (java.util.List)7 Solver (com.microsoft.z3.Solver)6 PageImpl (org.springframework.data.domain.PageImpl)6