use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class TraitTest method addAndModifyExistingMethod.
@Test
public void addAndModifyExistingMethod() {
Model model = assertParse("module M; " + " trait T = {Unit myMethod(){ println(\"\"); }} modifies { Unit myMethod(){ skip; } }" + " class C {uses T; }");
ClassDecl cls = (ClassDecl) findDecl(model, "M", "C");
assertNotNull(cls);
assertTrue(cls.getMethods().getNumChild() == 0);
model.applyTraits();
assertTrue(cls.getMethods().getNumChild() == 1);
assertTrue(cls.getMethod(0).getBlock().getStmt(0) instanceof SkipStmt);
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class FeatureModel method minimalFMwithProduct.
@Test
public void minimalFMwithProduct() throws DeltaModellingException, WrongProgramArgumentException {
Model model = assertParse("productline PL; features FM;" + "product P(FM);" + "root FM");
model.flattenForProduct("P");
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class FeatureModel method attributeBounded.
@Test
public void attributeBounded() throws DeltaModellingException, WrongProgramArgumentException {
Model model = assertParse("productline PL; features FM;" + "product P();" + "root FM { Int attr in [0 .. 99]; }");
model.flattenForProduct("P");
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class ParametricPartialFunctionTest method multipleFunctionsExpectingDifferentTypeParam.
@Test
public void multipleFunctionsExpectingDifferentTypeParam() {
Model model = parse("addResults(expectsString, expectsInt)(1);", "def Int addResults<T>(f, g)(T t) = f(t) + g(t);", "def Int expectsString(String s) = 1;", "def Int expectsInt(Int i) = 2;");
exception.expect(PardefModellingException.class);
testExpand(model);
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class ParametricPartialFunctionTest method unboundParametricDataTypeReturnType.
@Test
public void unboundParametricDataTypeReturnType() {
Model model = parse("returnResult(listOf)(1);", "def T returnResult<E, T>(f)(E e) = f(e);", "def List<E> listOf<E>(E e) = list[e];");
testExpand(model);
}
Aggregations