Search in sources :

Example 21 with ModelCheckingResult

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

the class LiftsTest method testOpenDoorWhileMoving.

@Test
public void testOpenDoorWhileMoving() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "OpenDoorWhileMoving.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    assertEquals("{doors_open=true, moving=true}", result.getLastState().toString());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 22 with ModelCheckingResult

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

the class LiftsTest method testSlowDoors.

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

Example 23 with ModelCheckingResult

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

the class LiftsTest method testLowerHigher.

@Test
public void testLowerHigher() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "LiftLowerHigher.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    assertEquals("{doors_open=false, moving=true, current_floor=-1}", result.getLastState().toString());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 24 with ModelCheckingResult

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

the class ModelCheckerMachineFilesTest method testSimpleModelWithoutVariables.

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

Example 25 with ModelCheckingResult

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

the class ModelCheckerMachineFilesTest method testSimpleModelsWithoutOperations.

@Test
public void testSimpleModelsWithoutOperations() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "OnlyInitViolation.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    assertEquals(1, result.getSteps());
    MachineNode simpleMachineWithoutViolation = parseMachineFromFile(dir + "OnlyInitNoViolation.mch");
    result = ExplicitStateModelChecker.check(simpleMachineWithoutViolation);
    assertEquals(true, result.isCorrect());
    assertEquals(1, result.getSteps());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) 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