Search in sources :

Example 11 with ModelCheckingResult

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

the class LiftsTest method testInvalidPositions.

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

Example 12 with ModelCheckingResult

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

the class ModelCheckerPerformanceTest method testLeuschelPerformanceMachines3.

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

Example 13 with ModelCheckingResult

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

the class AppView method checkwithChecker.

public void checkwithChecker(ModelChecker modelChecker) {
    task = new Task<ModelCheckingResult>() {

        @Override
        protected ModelCheckingResult call() throws Exception {
            return AppView.this.modelChecker.check();
        }
    };
    task.setOnSucceeded(event -> {
        ModelCheckingResult result = task.getValue();
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("Model Checking Result");
        switch(result.getType()) {
            case VERIFIED:
                alert.setHeaderText("The model is...");
                alert.setContentText("...VERIFIED via K-Induction Model Checking!\nNo counter-example found.");
                break;
            case EXCEEDED_MAX_STEPS:
                alert.setHeaderText("The model is...");
                alert.setContentText("...correct for " + result.getSteps() + " steps!\n(Warning: Exceeded max steps)");
                break;
            case COUNTER_EXAMPLE_FOUND:
                alert.setHeaderText("The model is...");
                alert.setContentText("...not correct!\nCounter-example found in state " + result.getLastState().toString() + ".\nReversed path: " + result.getCounterExamplePath());
                break;
            case LTL_COUNTER_EXAMPLE_FOUND:
                alert.setHeaderText("The LTL-model is...");
                alert.setContentText("...not correct!\nCounter-example found in state " + result.getLastState().toString() + ".\nReversed path: " + result.getCounterExamplePath());
                break;
            case UNKNOWN:
                alert.setHeaderText("Model checking result unknown...");
                alert.setContentText("... reason: " + result.getReason());
                break;
            case ABORTED:
                alert.setHeaderText("Model checking aborted...");
                alert.setContentText("... after " + result.getSteps() + " steps");
                break;
        }
        alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
        alert.showAndWait();
    });
    task.setOnCancelled(event -> {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("Model Checking Result");
        alert.setHeaderText("Modelchecking was canceled!");
        alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
        alert.showAndWait();
    });
    modelCheckingThread = new Thread(task);
    modelCheckingThread.start();
}
Also used : ParserException(de.bmoth.parser.ParserException) IOException(java.io.IOException) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult)

Example 14 with ModelCheckingResult

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

the class ModelCheckerPerformanceTest method testLeuschelPerformanceMachines2.

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

Example 15 with ModelCheckingResult

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

the class ModelCheckerPerformanceTest method testLeuschelPerformanceMachines1.

@Test
@Benchmark
public void testLeuschelPerformanceMachines1() throws IOException {
    MachineNode machine = parseMachineFromFile(dir + "/performance/CounterErr.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(machine);
    assertEquals(false, result.isCorrect());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Test(org.junit.Test) Benchmark(org.openjdk.jmh.annotations.Benchmark)

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