use of de.be4.eventb.core.parser.node.AEvent 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());
}
use of de.be4.eventb.core.parser.node.AEvent in project probparsers by bendisposto.
the class StructureTest method testWitnessTick.
@Test
public void testWitnessTick() throws Exception {
final Start root = parseInput("machine WitnessTick\nevents\nevent Eve\nwith\n@x' x' :: NAT\nend\nend", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PEvent> events = parseUnit.getEvents();
assertEquals(1, events.size());
final AEvent event = (AEvent) events.get(0);
final LinkedList<PWitness> witnesses = event.getWitnesses();
assertEquals(1, witnesses.size());
assertEquals("x'", ((AWitness) witnesses.get(0)).getName().getText());
}
use of de.be4.eventb.core.parser.node.AEvent in project prob2 by bendisposto.
the class MachineExtractor method caseAEvent.
@Override
public void caseAEvent(final AEvent node) {
EventExtractor eE = new EventExtractor(new Event(node.getName().getText(), EventType.ORDINARY, false), machineM.getMachine().getRefines(), typeEnv, getComment(node.getComments()));
node.apply(eE);
machineM = new MachineModifier(machineM.getMachine().addTo(BEvent.class, eE.getEvent()), typeEnv);
}
use of de.be4.eventb.core.parser.node.AEvent in project probparsers by bendisposto.
the class ASTPrologTest method testEvent.
@Test
public void testEvent() throws BCompoundException {
final AEventBModelParseUnit model = new AEventBModelParseUnit();
model.setName(new TIdentifierLiteral("mm"));
final AEventsModelClause events = new AEventsModelClause();
model.setModelClauses(Arrays.asList((PModelClause) events));
AEvent event = new AEvent();
events.setEvent(Arrays.asList((PEvent) event));
event.setEventName(new TIdentifierLiteral("testevent"));
event.setVariables(Arrays.asList(createId("param")));
event.setGuards(Arrays.asList((PPredicate) new ATruthPredicate()));
PSubstitution subst1 = new AAssignSubstitution(Arrays.asList(createId("x")), Arrays.asList(createId("param")));
event.setAssignments(Arrays.asList(subst1));
PWitness witness = new AWitness(new TIdentifierLiteral("ab"), new AEqualPredicate(createId("ab"), createId("y")));
event.setWitness(Arrays.asList(witness));
event.setRefines(Arrays.asList(new TIdentifierLiteral("abstract1"), new TIdentifierLiteral("abstract2")));
checkAST(0, "event_b_model($,mm,[events($,[" + "event($,testevent,[abstract1,abstract2],[identifier($,param)],[truth($)],[]," + "[assign($,[identifier($,x)],[identifier($,param)])]," + "[witness($,identifier(%,ab),equal($,identifier($,ab),identifier($,y)))])])])", model);
}
use of de.be4.eventb.core.parser.node.AEvent in project probparsers by bendisposto.
the class StructureTest method testWitnessTick.
@Test
public void testWitnessTick() throws Exception {
final Start root = parseInput("machine WitnessTick\nevents\nevent Eve\nwith\n@x' x' :: NAT\nend\nend", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PEvent> events = parseUnit.getEvents();
assertEquals(1, events.size());
final AEvent event = (AEvent) events.get(0);
final LinkedList<PWitness> witnesses = event.getWitnesses();
assertEquals(1, witnesses.size());
assertEquals("x'", ((AWitness) witnesses.get(0)).getName().getText());
}
Aggregations