use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class LocationTypeTests method testInferenceRetypeChecking.
@Test
public void testInferenceRetypeChecking() {
String code = "interface I { Unit m(); } { [Far] I i; I j; i = j; j.m(); }";
Model m = assertParseOkStdLib(code);
LocationTypeExtension te = new LocationTypeExtension(m);
m.registerTypeSystemExtension(te);
SemanticConditionList e = m.typeCheck();
m.typeCheck(new SemanticConditionList());
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class TypeCheckerTest method test_Movecogto1.
@Test
public void test_Movecogto1() {
Model m = assertParseOk("class C { Unit do() { movecogto 1; }}", Config.WITH_STD_LIB);
SemanticConditionList errs = m.typeCheck();
assertTrue(m.hasTypeErrors());
assertEquals(ErrorMessage.EXPECTED_DC, errs.getFirstError().msg);
}
use of abs.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("tests/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("tests/abssamples/deltas/PeerToPeer.abs", true);
m.setNullPrintStream();
m.flattenForProduct("P4");
m.flushCache();
SemanticConditionList res = m.typeCheck();
if (res.containsErrors())
fail(res.getFirstError().getMessage());
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class DeltaTrieTest method trieStructure1.
@Test
public void trieStructure1() {
Model model = assertParseOk("module Test;" + "delta D1;" + "delta D2;" + "productline PL;" + "features A,B;" + "delta D1 after D2 when A;" + "delta D2 when B;" + "root FM {" + " group [0..*] { A, B }" + "}");
ProductLine pl = model.getProductLine();
DeltaTrie pfgt = ProductLineAnalysisHelper.buildPFGT(pl, new SemanticConditionList());
// System.out.println(pfgt.toString());
assertTrue(pfgt.getRoot().isValidProduct());
assertEquals(2, pfgt.getRoot().getChildren().size());
assertTrue(pfgt.getRoot().getChildren().get("D1").isValidProduct());
assertTrue(pfgt.getRoot().getChildren().get("D2").isValidProduct());
assertEquals(0, pfgt.getRoot().getChildren().get("D1").getChildren().size());
assertEquals(1, pfgt.getRoot().getChildren().get("D2").getChildren().size());
assertTrue(pfgt.getRoot().getChildren().get("D2").getChildren().get("D1").isValidProduct());
}
use of abs.frontend.analyser.SemanticConditionList in project abstools by abstools.
the class DeltaTrieTest method trieStructure2.
@Test
public void trieStructure2() {
Model model = assertParseOk("module Test;" + "delta D1;" + "delta D2;" + "delta D3;" + "productline PL;" + "features A,B,C;" + "delta D1 when A;" + "delta D2 after D1 when B;" + "delta D3 after D2 when C;" + "root FM {" + " group [0..*] { A, B, C }" + "}");
ProductLine pl = model.getProductLine();
DeltaTrie pfgt = ProductLineAnalysisHelper.buildPFGT(pl, new SemanticConditionList());
assertTrue(pfgt.getRoot().isValidProduct());
assertEquals(3, pfgt.getRoot().getChildren().size());
assertTrue(pfgt.getRoot().getChildren().get("D1").isValidProduct());
assertTrue(pfgt.getRoot().getChildren().get("D2").isValidProduct());
assertTrue(pfgt.getRoot().getChildren().get("D3").isValidProduct());
assertEquals(2, pfgt.getRoot().getChildren().get("D1").getChildren().size());
assertEquals(1, pfgt.getRoot().getChildren().get("D2").getChildren().size());
assertEquals(0, pfgt.getRoot().getChildren().get("D3").getChildren().size());
assertTrue(pfgt.getRoot().getChildren().get("D1").getChildren().get("D2").isValidProduct());
assertTrue(pfgt.getRoot().getChildren().get("D1").getChildren().get("D3").isValidProduct());
assertTrue(pfgt.getRoot().getChildren().get("D2").getChildren().get("D3").isValidProduct());
}
Aggregations