use of de.bmoth.parser.ast.nodes.MachineNode in project bmoth by hhu-stups.
the class LTLMachineTest method testSimpleLTLTestMachine.
@Test
public void testSimpleLTLTestMachine() {
MachineNode machine = new MachineBuilder().setName("SimpleLTLTestMachine").setDefinitions("ASSERT_LTL_1 == \"F({x=7})\"").setVariables("x").setInvariant("x : 1..10").setInitialization("x := 1").addOperation("foo = SELECT x < 5 THEN x := x + 1 END").build();
assertNotNull(machine);
List<LTLFormula> ltlFormulas = machine.getLTLFormulas();
LTLFormula ltl1 = ltlFormulas.get(0);
assertEquals("ASSERT_LTL_1", ltl1.getName());
}
use of de.bmoth.parser.ast.nodes.MachineNode 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());
}
use of de.bmoth.parser.ast.nodes.MachineNode 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());
}
use of de.bmoth.parser.ast.nodes.MachineNode 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());
}
use of de.bmoth.parser.ast.nodes.MachineNode 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());
}
Aggregations