use of org.abs_models.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method targetedAndUntargetedOriginalCall.
@Test
public void targetedAndUntargetedOriginalCall() throws DeltaModellingException {
Model model = assertParse("module M;" + "class C { Unit m() {} }" + "delta D1; " + "uses M;" + "modifies class C { adds Unit n() {} }" + "delta D2; " + "uses M;" + "modifies class C { modifies Unit m() { original(); core.original(); } }" + "delta D3; " + "uses M;" + "modifies class C { modifies Unit n() { original(); D1.original(); } }");
DeltaDecl d1 = findDelta(model, "D1");
DeltaDecl d2 = findDelta(model, "D2");
DeltaDecl d3 = findDelta(model, "D3");
// Model.resolveOriginalCalls(new ArrayList<DeltaDecl>(Arrays.asList(d1,d2,d3)));
model.applyDeltas(new ArrayList<>(Arrays.asList(d1, d2, d3)));
ClassDecl cls = (ClassDecl) findDecl(model, "M", "C");
assertEquals(cls.getMethods().toString(), 4, cls.getMethods().getNumChild());
assertTrue(cls.getMethod(0).getMethodSig().getName().equals("m"));
assertTrue(cls.getMethod(1).getMethodSig().getName().equals("n"));
assertTrue(cls.getMethod(2).getMethodSig().getName().equals("m$ORIGIN_core"));
assertTrue(cls.getMethod(3).getMethodSig().getName().equals("n$ORIGIN_D1"));
}
Aggregations