use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.
the class LogicOperationsTest method implicationTest.
@Test
public void implicationTest() throws ParserException {
String formula = "x < 3 => x < 4";
FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
assertEquals("x", declarationNode.getName());
assertEquals(INTEGER, declarationNode.getType().toString());
}
use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.
the class LogicOperationsTest method equivalenceTest.
@Test
public void equivalenceTest() throws ParserException {
String formula = "x < y <=> y > x";
FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
assertEquals("x", declarationNode.getName());
assertEquals(INTEGER, declarationNode.getType().toString());
DeclarationNode declarationNode2 = formulaNode.getImplicitDeclarations().get(1);
assertEquals("y", declarationNode2.getName());
assertEquals(INTEGER, declarationNode2.getType().toString());
}
use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.
the class LogicOperationsTest method conjunctionTest.
@Test
public void conjunctionTest() throws ParserException {
String formula = "x < 3 & x > 4";
FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
assertEquals("x", declarationNode.getName());
assertEquals(INTEGER, declarationNode.getType().toString());
}
Aggregations