use of org.abs_models.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductLineTypeAnalysisTest method stronglyUnambiguousProductLine6.
@Test
public void stronglyUnambiguousProductLine6() {
Model model = assertParse("module M;" + "delta D1; uses M; modifies class C { adds Unit foo() {} }" + "delta D2; uses M; removes class C;" + "delta D3; uses M; adds class C {}" + "productline PL;" + "features A;" + "delta D1;" + "delta D2;" + "delta D3;");
ProductLine pl = model.getProductLine();
SemanticConditionList errors = new SemanticConditionList();
/* All 3 deltas are in same partition
* D1, D2, D3 act on the same class C
*/
assertFalse(ProductLineAnalysisHelper.isStronglyUnambiguous(pl, errors));
assertEquals(2, errors.getErrorCount());
}
use of org.abs_models.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductLineTypeAnalysisTest method wellFormedProductLine1.
@Test
public void wellFormedProductLine1() {
Model model = assertParse("module M;" + "delta D1;" + "delta D2;" + "productline PL;" + "features A;" + "delta D1 after D2;");
ProductLine pl = model.getProductLine();
SemanticConditionList errors = new SemanticConditionList();
/*
* No delta clause for D2
*/
assertFalse(ProductLineAnalysisHelper.wellFormedProductLine(pl, errors));
assertEquals(1, errors.getErrorCount());
}
use of org.abs_models.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class DeltaSamplesTest method test_P2P_P4.
/* @Test
public void test_P2P_P3() throws Exception {
Model m = assertTypeCheckFileOk("abssamples/deltas/PeerToPeer.abs", true);
m.setNullPrintStream();
thrown.expect(DeltaModellingWithNodeException.class);
m.flattenForProduct("P3");
}
*/
@Test
public void test_P2P_P4() throws Exception {
Model m = assertParseFileOk("abssamples/deltas/PeerToPeer.abs");
m.setNullPrintStream();
m.flattenForProduct("P4");
m.flushCache();
SemanticConditionList res = m.typeCheck();
if (res.containsErrors())
fail(res.getFirstError().getMessage());
}
use of org.abs_models.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class DeltaSamplesTest method test_ticket329.
@Test
public void test_ticket329() throws Exception {
Model m = assertParseFileOk("abssamples/deltas/bug329.abs");
SemanticConditionList errs = m.typeCheck();
/* We are expecting a missing delta in product M.PL: */
assertThat(errs.getFirstError(), instanceOf(TypeError.class));
TypeError te = (TypeError) errs.getFirstError();
Assert.assertEquals(ErrorMessage.NAME_NOT_RESOLVABLE, te.msg);
}
use of org.abs_models.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class ProductDeclarationTest method validProduct.
@Test
public void validProduct() throws WrongProgramArgumentException {
Model model = assertParse("product P1 = {F1, F2, F3};" + "root FM {" + "group allof { F1, F2, F3 }" + "}");
model.evaluateAllProductDeclarations();
ProductDecl p = model.findProduct("P1");
SemanticConditionList e = new SemanticConditionList();
typeCheck(model, p, e);
assertEquals(0, e.getErrorCount());
}
Aggregations