Search in sources :

Example 1 with AAction

use of de.be4.eventb.core.parser.node.AAction in project probparsers by bendisposto.

the class CommentTest method testAtSignInComment.

@Test
public void testAtSignInComment() throws Exception {
    final Start rootNode = parseInput("machine AtSignInComment\nevents\nevent testEvent\nthen\n@act1 skip\n@act2 skip\n// MyComment@act2\nend\nend", false);
    final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
    final AEvent event = (AEvent) parseUnit.getEvents().get(0);
    final LinkedList<PAction> actions = event.getActions();
    AAction labeledAction = (AAction) actions.get(0);
    assertEquals("act1", labeledAction.getName().getText());
    assertEquals("skip", labeledAction.getAction().getText());
    assertEquals(0, labeledAction.getComments().size());
    labeledAction = (AAction) actions.get(1);
    assertEquals("act2", labeledAction.getName().getText());
    assertEquals("skip", labeledAction.getAction().getText());
    assertNotNull(labeledAction.getComments());
    assertEquals("MyComment@act2", labeledAction.getComments().get(0).getText());
}
Also used : PAction(de.be4.eventbalg.core.parser.node.PAction) Start(de.be4.eventbalg.core.parser.node.Start) AEvent(de.be4.eventbalg.core.parser.node.AEvent) AMachineParseUnit(de.be4.eventbalg.core.parser.node.AMachineParseUnit) AAction(de.be4.eventbalg.core.parser.node.AAction) Test(org.junit.Test)

Example 2 with AAction

use of de.be4.eventb.core.parser.node.AAction in project probparsers by bendisposto.

the class CommentTest method testAtSignInComment.

@Test
public void testAtSignInComment() throws Exception {
    final Start rootNode = parseInput("machine AtSignInComment\nevents\nevent testEvent\nthen\n@act1 skip\n@act2 skip\n// MyComment@act2\nend\nend", false);
    final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
    final AEvent event = (AEvent) parseUnit.getEvents().get(0);
    final LinkedList<PAction> actions = event.getActions();
    AAction labeledAction = (AAction) actions.get(0);
    assertEquals("act1", labeledAction.getName().getText());
    assertEquals("skip", labeledAction.getAction().getText());
    assertEquals(0, labeledAction.getComments().size());
    labeledAction = (AAction) actions.get(1);
    assertEquals("act2", labeledAction.getName().getText());
    assertEquals("skip", labeledAction.getAction().getText());
    assertNotNull(labeledAction.getComments());
    assertEquals("MyComment@act2", labeledAction.getComments().get(0).getText());
}
Also used : PAction(de.be4.eventb.core.parser.node.PAction) Start(de.be4.eventb.core.parser.node.Start) AEvent(de.be4.eventb.core.parser.node.AEvent) AMachineParseUnit(de.be4.eventb.core.parser.node.AMachineParseUnit) AAction(de.be4.eventb.core.parser.node.AAction) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AAction (de.be4.eventb.core.parser.node.AAction)1 AEvent (de.be4.eventb.core.parser.node.AEvent)1 AMachineParseUnit (de.be4.eventb.core.parser.node.AMachineParseUnit)1 PAction (de.be4.eventb.core.parser.node.PAction)1 Start (de.be4.eventb.core.parser.node.Start)1 AAction (de.be4.eventbalg.core.parser.node.AAction)1 AEvent (de.be4.eventbalg.core.parser.node.AEvent)1 AMachineParseUnit (de.be4.eventbalg.core.parser.node.AMachineParseUnit)1 PAction (de.be4.eventbalg.core.parser.node.PAction)1 Start (de.be4.eventbalg.core.parser.node.Start)1