Search in sources :

Example 11 with MachineNode

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

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

the class MachinesTest method testAOperationParameter.

@Test
public void testAOperationParameter() {
    String machine = MACHINE_NAME;
    machine += VARIABLES_X_Y;
    machine += INVARIANT_X_Y;
    machine += INITIALISATION_X_1_Y_TRUE;
    machine += "OPERATIONS foo(p) = SELECT p = 1 THEN x := p END \n";
    machine += "END";
    MachineNode machineAsSemanticAst = parseMachine(machine);
    OperationNode operationNode = machineAsSemanticAst.getOperations().get(0);
    DeclarationNode p = operationNode.getParams().get(0);
    assertEquals("p", p.getName());
    assertEquals(INTEGER, p.getType().toString());
}
Also used : OperationNode(de.bmoth.parser.ast.nodes.OperationNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) MachineNode(de.bmoth.parser.ast.nodes.MachineNode) Test(org.junit.Test)

Example 13 with MachineNode

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

the class MachinesTest method testAnySubstitution.

@Test
public void testAnySubstitution() {
    String machine = MACHINE_NAME;
    machine += VARIABLES_X_Y;
    machine += INVARIANT_X_Y;
    machine += INITIALISATION_X_1_Y_TRUE;
    machine += "OPERATIONS foo = ANY p WHERE 1=1 THEN x := p END \n";
    machine += "END";
    MachineNode machineAsSemanticAst = parseMachine(machine);
    AnySubstitutionNode any = (AnySubstitutionNode) machineAsSemanticAst.getOperations().get(0).getSubstitution();
    DeclarationNode p = any.getParameters().get(0);
    assertEquals("p", p.getName());
    assertEquals(INTEGER, p.getType().toString());
}
Also used : AnySubstitutionNode(de.bmoth.parser.ast.nodes.AnySubstitutionNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) MachineNode(de.bmoth.parser.ast.nodes.MachineNode) Test(org.junit.Test)

Example 14 with MachineNode

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

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

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