use of org.abs_models.frontend.ast.ProductDecl in project abstools by abstools.
the class ProductDeclarationTest method rightSideProductName.
@Test
public void rightSideProductName() throws WrongProgramArgumentException {
Model model = assertParse("product P2(); product P3(); product P4(); product P1 = P2 && P3 || P4 || {F1, F2};");
ProductDecl p = model.findProduct("P1");
Set<String> actual = new HashSet<>();
p.getProductExpr().setRightSideProductNames(actual);
assertEquals(3, actual.size());
Set<String> expected = new HashSet<>(Arrays.asList("P2", "P3", "P4"));
assertEquals(expected, actual);
}
use of org.abs_models.frontend.ast.ProductDecl in project abstools by abstools.
the class ProductDeclarationTest method productName.
@Test
public void productName() throws WrongProgramArgumentException {
Model model = assertParse("product P1 = {F1, F2, F3};" + "product P2 = P1;");
model.evaluateAllProductDeclarations();
ProductDecl p = model.findProduct("P2");
Product impl = p.getProduct();
assertEquals(3, impl.getNumFeature());
Set<String> expected = new HashSet<>(Arrays.asList("F1", "F2", "F3"));
Set<String> actual = new HashSet<>();
for (Feature f : impl.getFeatures()) actual.add(f.getName());
assertEquals(expected, actual);
}
use of org.abs_models.frontend.ast.ProductDecl in project abstools by abstools.
the class ProductDeclarationTest method complexExpressionWithParenthesis.
@Test
public void complexExpressionWithParenthesis() throws WrongProgramArgumentException {
Model model = assertParse("product P1 = {F1, F2, F3} && ({F3, F4} || {F5}) || {F6} - {F6};");
model.evaluateAllProductDeclarations();
ProductDecl p = model.findProduct("P1");
Product impl = p.getProduct();
assertEquals(1, impl.getNumFeature());
Set<String> expected = new HashSet<>(Arrays.asList("F3"));
Set<String> actual = new HashSet<>();
for (Feature f : impl.getFeatures()) actual.add(f.getName());
assertEquals(expected, actual);
}
use of org.abs_models.frontend.ast.ProductDecl in project abstools by abstools.
the class ProductDeclarationTest method productDifference.
@Test
public void productDifference() throws WrongProgramArgumentException {
Model model = assertParse("product P1 = {F1, F2, F3, F4} - {F2, F3};");
model.evaluateAllProductDeclarations();
ProductDecl p = model.findProduct("P1");
Product impl = p.getProduct();
assertEquals(2, impl.getNumFeature());
Set<String> expected = new HashSet<>(Arrays.asList("F1", "F4"));
Set<String> actual = new HashSet<>();
for (Feature f : impl.getFeatures()) actual.add(f.getName());
assertEquals(expected, actual);
}
Aggregations