Search in sources :

Example 56 with DeclarationNode

use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.

the class RelationTest method directProductTest.

@Test
public void directProductTest() 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*INTEGER))", declarationNode.getType().toString());
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) Test(org.junit.Test)

Example 57 with DeclarationNode

use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.

the class RelationTest method identityTest.

@Test
@Ignore
public void identityTest() throws ParserException {
    String formula = "x = id({1,2})";
    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());
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 58 with DeclarationNode

use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.

the class RelationTest method projection1Test.

@Test
@Ignore
public void projection1Test() throws ParserException {
    String formula = "x = prj1({1,2},{3,4})";
    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());
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 59 with DeclarationNode

use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.

the class RelationTest method relationTest.

@Test
@Ignore
public void relationTest() throws ParserException {
    String formula = "x = {1,2} <-> {10,20}";
    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());
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 60 with DeclarationNode

use of de.bmoth.parser.ast.nodes.DeclarationNode in project bmoth by hhu-stups.

the class RelationTest method forwardCompositionTest.

@Test
@Ignore
public void forwardCompositionTest() throws ParserException {
    String formula = "x = ({1|->2,2|->3} ; {2|->1,3|->2})";
    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());
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) DeclarationNode(de.bmoth.parser.ast.nodes.DeclarationNode) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

DeclarationNode (de.bmoth.parser.ast.nodes.DeclarationNode)93 Test (org.junit.Test)92 FormulaNode (de.bmoth.parser.ast.nodes.FormulaNode)91 Ignore (org.junit.Ignore)27 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)2 ParserException (de.bmoth.parser.ParserException)1 AnySubstitutionNode (de.bmoth.parser.ast.nodes.AnySubstitutionNode)1 OperationNode (de.bmoth.parser.ast.nodes.OperationNode)1 HashMap (java.util.HashMap)1