use of abs.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method targetedAndUntargetedOriginalCall.
@Test
public void targetedAndUntargetedOriginalCall() throws DeltaModellingException {
Model model = assertParseOk("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"));
}
use of abs.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method originalNotFound.
@Test(expected = DeltaModellingException.class)
public void originalNotFound() throws DeltaModellingException {
Model model = assertParseOk("module M;" + "class C { }" + "delta D1;" + "modifies class C { modifies Unit m() { original(); } }");
DeltaDecl d1 = findDelta(model, "D1");
// Model.resolveOriginalCalls(new ArrayList<DeltaDecl>(Arrays.asList(d1)));
model.applyDeltas(new ArrayList<>(Arrays.asList(d1)));
}
use of abs.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method targetedOriginalCall.
@Test
public void targetedOriginalCall() throws DeltaModellingException {
Model model = assertParseOk("module M;" + "class C { Unit m() {} }" + "delta D1;" + "uses M;" + "modifies class C { modifies Unit m() { core.original(); } }" + "adds class C2 { }" + "delta D2;" + "modifies class M.C { modifies Unit m() { D1.original(); } }");
DeltaDecl d1 = findDelta(model, "D1");
DeltaDecl d2 = findDelta(model, "D2");
// Model.resolveOriginalCalls(new ArrayList<DeltaDecl>(Arrays.asList(d1,d2)));
model.applyDeltas(new ArrayList<>(Arrays.asList(d1, d2)));
ClassDecl cls = (ClassDecl) findDecl(model, "M", "C");
assertEquals(cls.getMethods().toString(), 3, cls.getMethods().getNumChild());
assertTrue(cls.getMethod(0).getMethodSig().getName().equals("m"));
assertTrue(cls.getMethod(1).getMethodSig().getName().equals("m$ORIGIN_core"));
assertTrue(cls.getMethod(2).getMethodSig().getName().equals("m$ORIGIN_D1"));
}
use of abs.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method multipleTargetedOriginalCalls.
@Test
public void multipleTargetedOriginalCalls() throws DeltaModellingException {
Model model = assertParseOk("module M;" + "class C { }" + "delta D1;" + "uses M;" + "modifies class C { adds Unit m() {} }" + "delta D2;uses M;" + "modifies class C { modifies Unit m() { D1.original(); } }" + "delta D3;uses M;" + "modifies class C { modifies Unit m() { 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(), 2, cls.getMethods().getNumChild());
assertTrue(cls.getMethod(0).getMethodSig().getName().equals("m"));
assertTrue(cls.getMethod(1).getMethodSig().getName().equals("m$ORIGIN_D1"));
}
use of abs.frontend.ast.DeltaDecl in project abstools by abstools.
the class OriginalCallTest method targetedOriginalNotFound.
@Test(expected = DeltaModellingException.class)
public void targetedOriginalNotFound() throws DeltaModellingException {
Model model = assertParseOk("module M;" + "class C { }" + "delta D1;" + "uses M;" + "modifies class C { modifies Unit m() { core.original(); } }");
DeltaDecl d1 = findDelta(model, "D1");
// Model.resolveOriginalCalls(new ArrayList<DeltaDecl>(Arrays.asList(d1)));
model.applyDeltas(new ArrayList<>(Arrays.asList(d1)));
}
Aggregations