Search in sources :

Example 6 with MachineNode

use of de.bmoth.parser.ast.nodes.MachineNode in project bmoth by hhu-stups.

the class LiftsTest method testFastDoors.

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

use of de.bmoth.parser.ast.nodes.MachineNode in project bmoth by hhu-stups.

the class LiftsTest method testMissingEmergencyCall.

@Test
public void testMissingEmergencyCall() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "EmergencyCallFail.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 8 with MachineNode

use of de.bmoth.parser.ast.nodes.MachineNode in project bmoth by hhu-stups.

the class LiftsTest method testLiftDoesNotMoveTowardsFirstPressedButton.

@Ignore("iseq not implemented in FormularToZ3Translator")
@Test
public void testLiftDoesNotMoveTowardsFirstPressedButton() {
    MachineNode simpleMachineWithViolation = parseMachineFromFile(dir + "LiftDoesNotMoveTowardsFirstPressedButton.mch");
    ModelCheckingResult result = ExplicitStateModelChecker.check(simpleMachineWithViolation);
    assertEquals(false, result.isCorrect());
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) ModelCheckingResult(de.bmoth.modelchecker.ModelCheckingResult) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with MachineNode

use of de.bmoth.parser.ast.nodes.MachineNode 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 10 with MachineNode

use of de.bmoth.parser.ast.nodes.MachineNode in project bmoth by hhu-stups.

the class CSTAnalyserTest method testWarningInPropertiesClause.

@Test
public void testWarningInPropertiesClause() {
    String machine = "MACHINE test\n";
    machine += "PROPERTIES TRUE or FALSE & FALSE \n";
    machine += "END";
    MachineNode machineNode = parseMachine(machine);
    List<String> warnings = machineNode.getWarnings();
    assertEquals(1, warnings.size());
    assertEquals("Ambiguous combination of operators 'or' (line 2, pos 16) and '&' (line 2, pos 25)." + " Use parentheses to avoid this.", warnings.get(0));
}
Also used : MachineNode(de.bmoth.parser.ast.nodes.MachineNode) Test(org.junit.Test)

Aggregations

MachineNode (de.bmoth.parser.ast.nodes.MachineNode)30 Test (org.junit.Test)25 ModelCheckingResult (de.bmoth.modelchecker.ModelCheckingResult)22 ParserException (de.bmoth.parser.ParserException)2 DeclarationNode (de.bmoth.parser.ast.nodes.DeclarationNode)2 Expr (com.microsoft.z3.Expr)1 BMoThParser (de.bmoth.antlr.BMoThParser)1 LtlStartContext (de.bmoth.antlr.BMoThParser.LtlStartContext)1 StartContext (de.bmoth.antlr.BMoThParser.StartContext)1 SemanticAstCreator (de.bmoth.parser.ast.SemanticAstCreator)1 TypeErrorException (de.bmoth.parser.ast.TypeErrorException)1 AnySubstitutionNode (de.bmoth.parser.ast.nodes.AnySubstitutionNode)1 OperationNode (de.bmoth.parser.ast.nodes.OperationNode)1 LTLFormula (de.bmoth.parser.ast.nodes.ltl.LTLFormula)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 StringJoiner (java.util.StringJoiner)1 Ignore (org.junit.Ignore)1 Benchmark (org.openjdk.jmh.annotations.Benchmark)1