Search in sources :

Example 66 with DeclarationNode

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

the class SequenceTest method finiteNonEmptySequencesTest.

@Test
public void finiteNonEmptySequencesTest() throws ParserException {
    String formula = "x = seq1({1,2,3})";
    FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
    assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
    DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
    assertEquals("x", declarationNode.getName());
    assertEquals(POW_POW_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 67 with DeclarationNode

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

the class SequenceTest method singletonSequenceTest.

@Test
public void singletonSequenceTest() throws ParserException {
    String formula = "x = [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) Test(org.junit.Test)

Example 68 with DeclarationNode

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

the class SequenceTest method injectiveSequencesTest.

@Test
public void injectiveSequencesTest() throws ParserException {
    String formula = "x = iseq({1,2,3})";
    FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
    assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
    DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
    assertEquals("x", declarationNode.getName());
    assertEquals(POW_POW_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 69 with DeclarationNode

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

the class SequenceTest method emptySequenceTest.

@Test
public void emptySequenceTest() throws ParserException {
    String formula = "x = <> & x <: NAT*NAT";
    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) Test(org.junit.Test)

Example 70 with DeclarationNode

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

the class SequenceTest method finiteSequencesTest.

@Test
public void finiteSequencesTest() throws ParserException {
    String formula = "x = seq({1,2,3})";
    FormulaNode formulaNode = Parser.getFormulaAsSemanticAst(formula);
    assertEquals(PREDICATE_FORMULA, formulaNode.getFormulaType());
    DeclarationNode declarationNode = formulaNode.getImplicitDeclarations().get(0);
    assertEquals("x", declarationNode.getName());
    assertEquals(POW_POW_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)

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