Search in sources :

Example 16 with ModelCheckingResult

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

the class CliTask method doModelCheck.

private ModelCheckingResult doModelCheck(ModelChecker modelChecker) {
    ModelCheckingResult result;
    long start = isBenchmark ? System.nanoTime() : 0;
    result = modelChecker.check();
    nanoDiffTime = isBenchmark ? System.nanoTime() - start : 0;
    return result;
}
Also used : ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult)

Example 17 with ModelCheckingResult

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

the class CliTask method execute.

public void execute() {
    if (isBenchmark) {
        executeBenchmarks();
    } else {
        MachineNode machineNode = parseMachine(readMachineContent());
        ModelCheckingResult result = doModelCheck(getModelChecker(machineNode));
        logger.info("Result: " + result.toString());
    }
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult)

Example 18 with ModelCheckingResult

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

the class LiftsTest method testCrashing.

@Test
public void testCrashing() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "CrashingLift.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    assertEquals("{old_floor=3, old_time=3, current_time=4, current_floor=0}", result.getLastState().toString());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test)

Example 19 with ModelCheckingResult

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

the class LiftsTest method testNotMoving.

@Test
public void testNotMoving() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "NotMoving.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 20 with ModelCheckingResult

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

the class LiftsTest method testTargetAndCurrentCorrespond.

@Test
public void testTargetAndCurrentCorrespond() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "TargetAndCurrentCorrespond.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
    Expr targetFloor = result.getLastState().getValues().get("target_floor");
    Expr currentFloor = result.getLastState().getValues().get("current_floor");
    assertNotEquals(targetFloor.toString(), currentFloor.toString());
}
Also used : Expr(com.microsoft.z3.Expr) 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