Search in sources :

Example 1 with QuantifiedExpressionNode

use of org.kie.dmn.feel.lang.ast.QuantifiedExpressionNode in project drools by kiegroup.

the class FEELParserTest method testQuantifiedExpressionEvery.

@Test
public void testQuantifiedExpressionEvery() {
    String inputExpression = "every item in order.items satisfies item.price > 100";
    BaseNode everyBase = parse(inputExpression);
    assertThat(everyBase, is(instanceOf(QuantifiedExpressionNode.class)));
    assertThat(everyBase.getText(), is(inputExpression));
    assertThat(everyBase.getResultType(), is(BuiltInType.BOOLEAN));
    QuantifiedExpressionNode everyExpr = (QuantifiedExpressionNode) everyBase;
    assertThat(everyExpr.getQuantifier(), is(QuantifiedExpressionNode.Quantifier.EVERY));
    assertThat(everyExpr.getIterationContexts().size(), is(1));
    assertThat(everyExpr.getIterationContexts().get(0).getText(), is("item in order.items"));
    assertThat(everyExpr.getExpression().getText(), is("item.price > 100"));
}
Also used : QuantifiedExpressionNode(org.kie.dmn.feel.lang.ast.QuantifiedExpressionNode) BaseNode(org.kie.dmn.feel.lang.ast.BaseNode) Test(org.junit.Test)

Example 2 with QuantifiedExpressionNode

use of org.kie.dmn.feel.lang.ast.QuantifiedExpressionNode in project drools by kiegroup.

the class FEELParserTest method testQuantifiedExpressionSome.

@Test
public void testQuantifiedExpressionSome() {
    String inputExpression = "some item in order.items satisfies item.price > 100";
    BaseNode someBase = parse(inputExpression);
    assertThat(someBase, is(instanceOf(QuantifiedExpressionNode.class)));
    assertThat(someBase.getText(), is(inputExpression));
    assertThat(someBase.getResultType(), is(BuiltInType.BOOLEAN));
    QuantifiedExpressionNode someExpr = (QuantifiedExpressionNode) someBase;
    assertThat(someExpr.getQuantifier(), is(QuantifiedExpressionNode.Quantifier.SOME));
    assertThat(someExpr.getIterationContexts().size(), is(1));
    assertThat(someExpr.getIterationContexts().get(0).getText(), is("item in order.items"));
    assertThat(someExpr.getExpression().getText(), is("item.price > 100"));
}
Also used : QuantifiedExpressionNode(org.kie.dmn.feel.lang.ast.QuantifiedExpressionNode) BaseNode(org.kie.dmn.feel.lang.ast.BaseNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BaseNode (org.kie.dmn.feel.lang.ast.BaseNode)2 QuantifiedExpressionNode (org.kie.dmn.feel.lang.ast.QuantifiedExpressionNode)2