use of de.bmoth.parser.ast.nodes.FormulaNode in project bmoth by hhu-stups.
the class ASTTransformationTest method testElementOfCombinedWithUnion.
@Test
public void testElementOfCombinedWithUnion() {
String formula = "a : {1} \\/ b";
FormulaNode formulaNode = parseFormula(formula);
formulaNode = AstTransformationsForZ3.transformFormulaNode(formulaNode);
assertEquals("OR(ELEMENT_OF(a,SET_ENUMERATION(1)),ELEMENT_OF(a,b))", formulaNode.getFormula().toString());
}
use of de.bmoth.parser.ast.nodes.FormulaNode in project bmoth by hhu-stups.
the class ConstantFoldingTest method testIntegerAddition.
@Test
public void testIntegerAddition() {
String formula = "a = 1+2+3";
FormulaNode formulaNode = parseFormula(formula);
formulaNode = AstTransformationsForZ3.transformFormulaNode(formulaNode);
assertEquals("EQUAL(a,6)", formulaNode.getFormula().toString());
}
use of de.bmoth.parser.ast.nodes.FormulaNode in project bmoth by hhu-stups.
the class OperatorCoverageTest method testPredicateFormula.
@Test
public void testPredicateFormula() {
String formula = "a * b = x & b = 1";
FormulaNode formulaNode = parseFormula(formula);
assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
DeclarationNode node1 = formulaNode.getImplicitDeclarations().get(0);
DeclarationNode node2 = formulaNode.getImplicitDeclarations().get(1);
assertEquals("a", node1.getName());
assertEquals("b", node2.getName());
assertEquals(INTEGER, node1.getType().toString());
assertEquals(INTEGER, node2.getType().toString());
}
use of de.bmoth.parser.ast.nodes.FormulaNode in project bmoth by hhu-stups.
the class CSTAnalyserTest method testNoWarningInFormula.
@Test
public void testNoWarningInFormula() {
String formula = "(TRUE or FALSE) & FALSE";
FormulaNode formulaNode = parseFormula(formula);
List<String> warnings = formulaNode.getWarnings();
assertEquals(0, warnings.size());
}
use of de.bmoth.parser.ast.nodes.FormulaNode in project bmoth by hhu-stups.
the class CSTAnalyserTest method testWarningInFormula.
@Test
public void testWarningInFormula() {
String formula = "TRUE or FALSE & FALSE";
FormulaNode formulaNode = parseFormula(formula);
List<String> warnings = formulaNode.getWarnings();
assertEquals(1, warnings.size());
assertEquals("Ambiguous combination of operators 'or' (line 1, pos 5) and '&' (line 1, pos 14)." + " Use parentheses to avoid this.", warnings.get(0));
}
Aggregations