use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductDeclarationTest method undeclaredProduct.
@Test
public void undeclaredProduct() throws WrongProgramArgumentException {
Model model = assertParseOk("product P1 = P2 && P3 || P4 || {F1, F2};");
ProductDecl p = model.findProduct("P1");
SemanticConditionList e = new SemanticConditionList();
typeCheck(model, p, e);
assertEquals(3, e.getErrorCount());
assertEquals(ErrorMessage.UNDECLARED_PRODUCT, e.getFirstError().msg);
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductDeclarationTest method invalidProduct.
@Test
public void invalidProduct() throws WrongProgramArgumentException {
Model model = assertParseOk("product P1 = {F1, F2};" + "root FM {" + "group allof { F1, F2, F3 }" + "}");
model.evaluateAllProductDeclarations();
ProductDecl p = model.findProduct("P1");
SemanticConditionList e = new SemanticConditionList();
typeCheck(model, p, e);
assertEquals(1, e.getErrorCount());
assertEquals(ErrorMessage.INVALID_PRODUCT, e.getFirstError().msg);
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductLineTypeAnalysisTest method stronglyUnambiguousProductLine2.
@Test
public void stronglyUnambiguousProductLine2() {
Model model = assertParseOk("module M;" + "delta D1; uses M; modifies class C { adds Unit foo() {} }" + "delta D2; uses M; modifies class C { adds Unit bar() {} }" + "productline PL;" + "features A;" + "delta D1;" + "delta D2;");
ProductLine pl = model.getProductLine();
SemanticConditionList errors = new SemanticConditionList();
/*
* Both deltas are in same partition (no order specified)
* They modify class C in different ways, by adding different methods
*/
assertTrue(ProductLineAnalysisHelper.isStronglyUnambiguous(pl, errors));
assertEquals(0, errors.getErrorCount());
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductLineTypeAnalysisTest method wellFormedProductLine2.
@Test
public void wellFormedProductLine2() {
Model model = assertParseOk("module M;" + "delta D1;" + "delta D2;" + "productline PL;" + "features A;" + "delta D1 after D2;" + "delta D2;");
ProductLine pl = model.getProductLine();
SemanticConditionList errors = new SemanticConditionList();
/*
* All OK
*/
assertTrue(ProductLineAnalysisHelper.wellFormedProductLine(pl, errors));
assertEquals(0, errors.getErrorCount());
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductLineTypeAnalysisTest method stronglyUnambiguousProductLine5.
@Test
public void stronglyUnambiguousProductLine5() {
Model model = assertParseOk("module M;" + "delta D1; uses M; adds class C {}" + "delta D2; uses M; removes class C;" + "productline PL;" + "features A;" + "delta D1;" + "delta D2;");
ProductLine pl = model.getProductLine();
SemanticConditionList errors = new SemanticConditionList();
/* Both deltas are in same partition (no order specified)
* Both deltas act on the same class C
*/
assertFalse(ProductLineAnalysisHelper.isStronglyUnambiguous(pl, errors));
assertEquals(1, errors.getErrorCount());
}
Aggregations