use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class DeltaOrderingTest method circularOrder1.
@Test(expected = DeltaModellingException.class)
public void circularOrder1() throws DeltaModellingException, WrongProgramArgumentException {
Model model = assertParse("module M;" + "delta D1;" + "delta D2;" + "productline PL;" + "features A;" + "delta D1 after D2 when A;" + "delta D2 after D1 when A;" + "product P(A);");
model.evaluateAllProductDeclarations();
model.flattenForProduct("P");
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class DeltaOrderingTest method properSorting9.
@Test
public void properSorting9() throws DeltaModellingException, WrongProgramArgumentException {
Model model = assertParse("module Test;" + "delta D1;" + "delta D2;" + "delta D3;" + "delta D4;" + "delta D5;" + "delta D6;" + "delta D7;" + "delta D8;" + "delta D9;" + "productline PL;" + "features A,B,C,D,E,F,G,H,I;" + "delta D1 after D2 when A;" + "delta D2 after D3 when B;" + "delta D3 after D4 when C;" + "delta D4 after D5 when D;" + "delta D5 after D6 when E;" + "delta D6 after D7 when F;" + "delta D7 after D8 when G;" + "delta D8 after D9 when H;" + "delta D9 when I;" + "product P1(A,B,C,D,E,F,G,H,I);" + "product P2(A,C,E,G,I);");
model.evaluateAllProductDeclarations();
ProductDecl prod = model.findProduct("P1");
ProductLine pl = model.getProductLine();
Set<String> deltaids = pl.findApplicableDeltas(prod.getProduct());
List<String> sorted_deltaids = pl.sortDeltas(deltaids);
assertArrayEquals(new String[] { "D9", "D8", "D7", "D6", "D5", "D4", "D3", "D2", "D1" }, sorted_deltaids.toArray());
prod = model.findProduct("P2");
deltaids = pl.findApplicableDeltas(prod.getProduct());
sorted_deltaids = pl.sortDeltas(deltaids);
assertArrayEquals(new String[] { "D9", "D7", "D5", "D3", "D1" }, sorted_deltaids.toArray());
assertFalse(model.typeCheck().containsErrors());
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class MaudeTests method getMaudeCode.
protected String getMaudeCode(String absCode, MaudeCompiler.SIMULATOR module) throws Exception {
Model model = assertParse(absCode, Config.WITHOUT_MODULE_NAME, Config.TYPE_CHECK);
ByteArrayOutputStream out = new ByteArrayOutputStream();
// TODO: handle delta generation / testing / flattening
model.generateMaude(new PrintStream(out), module, 100, 0);
String res = out.toString();
return res;
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class ASTBasedABSTestRunnerGeneratorTest method testABSTestRunnerGenerator.
@Test
public final void testABSTestRunnerGenerator() {
Model model = new Model();
ABSTestRunnerGenerator generator = new ASTBasedABSTestRunnerGenerator(model);
assertMatches(model, nullValue(), nullValue(), nullValue(), nullValue(), equalTo(EMPTY_MAP), Boolean.TRUE, generator);
try {
model = ABSTest.parseString(ABS_UNIT);
generator = new ASTBasedABSTestRunnerGenerator(model);
assertMatches(model, notNullValue(), notNullValue(), notNullValue(), notNullValue(), equalTo(EMPTY_MAP), Boolean.TRUE, generator);
model = ABSTest.parseString(ABS_UNIT + TEST_CODE);
generator = new ASTBasedABSTestRunnerGenerator(model);
assertMatches(model, notNullValue(), notNullValue(), notNullValue(), notNullValue(), both(everyItem(new TestClassMatcher())).and(new SizeMatcher(1)), Boolean.FALSE, generator);
} catch (Exception e) {
throw new IllegalStateException("Cannot parse test code", e);
}
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class OriginalCallTest method targetedOriginalNotFound.
@Test(expected = DeltaModellingException.class)
public void targetedOriginalNotFound() throws DeltaModellingException {
Model model = assertParse("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