Search in sources :

Example 1 with Node

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

the class LTLFormulaTest method testGloballyFinally.

@Test
public void testGloballyFinally() throws ParserException {
    String formula = "FG { 1=1 }";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    Node f1 = ltlFormula.getLTLNode();
    assertTrue(f1 instanceof LTLPrefixOperatorNode);
    LTLPrefixOperatorNode p1 = (LTLPrefixOperatorNode) f1;
    assertEquals(LTLPrefixOperatorNode.Kind.FINALLY, p1.getKind());
    LTLNode f2 = p1.getArgument();
    assertTrue(f2 instanceof LTLPrefixOperatorNode);
    LTLPrefixOperatorNode p2 = (LTLPrefixOperatorNode) f2;
    assertEquals(LTLPrefixOperatorNode.Kind.GLOBALLY, p2.getKind());
    LTLNode f3 = p2.getArgument();
    assertTrue(f3 instanceof LTLBPredicateNode);
    LTLBPredicateNode p3 = (LTLBPredicateNode) f3;
    assertTrue(p3.getPredicate() != null);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) LTLPrefixOperatorNode(de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) LTLBPredicateNode(de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode) LTLPrefixOperatorNode(de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Node(de.bmoth.parser.ast.nodes.Node) LTLBPredicateNode(de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode) Test(org.junit.Test)

Aggregations

Node (de.bmoth.parser.ast.nodes.Node)1 LTLBPredicateNode (de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode)1 LTLFormula (de.bmoth.parser.ast.nodes.ltl.LTLFormula)1 LTLNode (de.bmoth.parser.ast.nodes.ltl.LTLNode)1 LTLPrefixOperatorNode (de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode)1 Test (org.junit.Test)1