Search in sources :

Example 1 with AnySubstitutionNode

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

Aggregations

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