Search in sources :

Example 1 with ModelCheckingResult

use of de.bmoth.modelchecker.ModelCheckingResult in project bmoth by hhu-stups.

the class Issue39Test method testMachine2.

@Test
public void testMachine2() throws IOException {
    MachineNode theMachine = parseMachineFromFile(dir + "SetVarToConstantNoViolation.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(theMachine);
    assertEquals(true, result.isCorrect());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 2 with ModelCheckingResult

use of de.bmoth.modelchecker.ModelCheckingResult in project bmoth by hhu-stups.

the class Issue39Test method testMachine1.

@Test
public void testMachine1() throws IOException {
    MachineNode theMachine = parseMachineFromFile(dir + "SetVarToConstantViolation.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(theMachine);
    assertEquals(false, result.isCorrect());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 3 with ModelCheckingResult

use of de.bmoth.modelchecker.ModelCheckingResult in project bmoth by hhu-stups.

the class Issue59Test method testArithmeticLawsMachine.

@Test
public void testArithmeticLawsMachine() {
    MachineNode simpleMachineWithoutViolation = parseMachineFromFile("src/test/resources/machines/OnlyInitNoViolation.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithoutViolation);
    assertEquals(true, result.isCorrect());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 4 with ModelCheckingResult

use of de.bmoth.modelchecker.ModelCheckingResult in project bmoth by hhu-stups.

the class Issue59Test method testIssue59.

@Test
public void testIssue59() {
    String machine = "MACHINE SimpleMachine\n";
    machine += "VARIABLES x\n";
    machine += "INVARIANT x : INTEGER &\n";
    machine += "\tx**2 = x*x \n";
    machine += "INITIALISATION x := -3\n";
    machine += "OPERATIONS\n";
    machine += "\tIncX = SELECT x < 50 THEN x := x+1 END\n";
    machine += "END";
    ModelCheckingResult result = new ExplicitStateModelChecker(parseMachine(machine)).check();
    assertEquals(true, result.isCorrect());
}
Also used : ExplicitStateModelChecker(de.bmoth.modelchecker.esmc.ExplicitStateModelChecker) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 5 with ModelCheckingResult

use of de.bmoth.modelchecker.ModelCheckingResult in project bmoth by hhu-stups.

the class Issue89Test method testPinDownPowProblem.

@Test
public void testPinDownPowProblem() {
    String machine = "MACHINE PinDownPowProblem\n";
    machine += "VARIABLES\n";
    machine += "\tx, y\n";
    machine += "INVARIANT\n";
    machine += "\tx : INTEGER\n";
    machine += "\t& y : INTEGER\n";
    machine += "\t& x < 100\n";
    machine += "INITIALISATION\n";
    machine += "\tx := 10**5\n";
    machine += "\t|| y := 2**32-1\n";
    machine += "OPERATIONS\n";
    machine += "inc = BEGIN x := 2 * x END\n" + "END";
    ModelCheckingResult result = ExplicitStateModelChecker.check(parseMachine(machine));
    assertFalse(result.isCorrect());
    assertEquals(1, result.getSteps());
    assertEquals("{x=100000, y=4294967295}", result.getLastState().toString());
}
Also used : ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Aggregations

ModelCheckingResult (de.bmoth.modelchecker.ModelCheckingResult)28 Test (org.junit.Test)24 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)22 ExplicitStateModelChecker (de.bmoth.modelchecker.esmc.ExplicitStateModelChecker)2 BoolExpr (com.microsoft.z3.BoolExpr)1 Expr (com.microsoft.z3.Expr)1 Model (com.microsoft.z3.Model)1 Status (com.microsoft.z3.Status)1 ParserException (de.bmoth.parser.ParserException)1 IOException (java.io.IOException)1 Ignore (org.junit.Ignore)1 Benchmark (org.openjdk.jmh.annotations.Benchmark)1