Search in sources :

Example 1 with OperationNode

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

Aggregations

DeclarationNode (de.bmoth.parser.ast.nodes.DeclarationNode)1 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)1 OperationNode (de.bmoth.parser.ast.nodes.OperationNode)1 Test (org.junit.Test)1