use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.
the class NumbersTest method natTest.
@Test
public void natTest() throws ParserException {
String formula = "x : NAT";
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 NumbersTest method powerTest.
@Test
public void powerTest() throws ParserException {
String formula = "x = 2 ** 3";
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 NumbersTest method maximumTest.
@Test
public void maximumTest() throws ParserException {
String formula = "x = max({1,2})";
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 NumbersTest method quotientTest.
@Test
public void quotientTest() throws ParserException {
String formula = "x = 6 / 3";
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 RelationTest method rightOverridingTest.
@Test
public void rightOverridingTest() throws ParserException {
String formula = "x = {1|->2}<+{1|->3}";
FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
assertEquals("x", declarationNode.getName());
assertEquals(POW_INTEGER_INTEGER, declarationNode.getType().toString());
}
Aggregations