4848import dev .cel .runtime .CelLiteRuntime .Program ;
4949import dev .cel .runtime .RuntimeEquality ;
5050import dev .cel .runtime .RuntimeHelpers ;
51+ import dev .cel .runtime .standard .AddOperator ;
5152import dev .cel .runtime .standard .CelStandardFunction ;
5253import dev .cel .runtime .standard .DivideOperator ;
5354import dev .cel .runtime .standard .EqualsOperator ;
@@ -112,6 +113,7 @@ private static DefaultDispatcher newDispatcher() {
112113 // Subsetted StdLib
113114 addBindings (builder , Operator .INDEX .getFunction (), fromStandardFunction (IndexOperator .create ()));
114115 addBindings (builder , Operator .LOGICAL_NOT .getFunction (), fromStandardFunction (LogicalNotOperator .create ()));
116+ addBindings (builder , Operator .ADD .getFunction (), fromStandardFunction (AddOperator .create ()));
115117 addBindings (builder , Operator .GREATER .getFunction (), fromStandardFunction (GreaterOperator .create ()));
116118 addBindings (builder , Operator .GREATER_EQUALS .getFunction (), fromStandardFunction (
117119 GreaterEqualsOperator .create ()));
@@ -456,11 +458,12 @@ public void planSelect() throws Exception {
456458 }
457459
458460 @ Test
459- @ TestParameters ("{expression: '[1,2,3].exists(x, x > 0) == true'}" )
460- @ TestParameters ("{expression: '[1,2,3].exists(x, x < 0) == false'}" )
461- @ TestParameters ("{expression: '[1,2,3].exists(i, v, i >= 0 && v > 0) == true'}" )
462- @ TestParameters ("{expression: '[1,2,3].exists(i, v, i < 0 || v < 0) == false'}" )
463- public void planComprehension (String expression ) throws Exception {
461+ // @TestParameters("{expression: '[1,2,3].exists(x, x > 0) == true'}")
462+ // @TestParameters("{expression: '[1,2,3].exists(x, x < 0) == false'}")
463+ // @TestParameters("{expression: '[1,2,3].exists(i, v, i >= 0 && v > 0) == true'}")
464+ // @TestParameters("{expression: '[1,2,3].exists(i, v, i < 0 || v < 0) == false'}")
465+ @ TestParameters ("{expression: '[1,2,3].map(x, x + 1) == [2,3,4]'}" )
466+ public void planComprehension_lists (String expression ) throws Exception {
464467 CelAbstractSyntaxTree ast = compile (expression );
465468 Program program = PLANNER .plan (ast );
466469
@@ -469,6 +472,20 @@ public void planComprehension(String expression) throws Exception {
469472 assertThat (result ).isTrue ();
470473 }
471474
475+ // @Test
476+ // @TestParameters("{expression: '[1,2,3].exists(x, x > 0) == true'}")
477+ // @TestParameters("{expression: '[1,2,3].exists(x, x < 0) == false'}")
478+ // @TestParameters("{expression: '[1,2,3].exists(i, v, i >= 0 && v > 0) == true'}")
479+ // @TestParameters("{expression: '[1,2,3].exists(i, v, i < 0 || v < 0) == false'}")
480+ // public void planComprehension_maps(String expression) throws Exception {
481+ // CelAbstractSyntaxTree ast = compile(expression);
482+ // Program program = PLANNER.plan(ast);
483+ //
484+ // boolean result = (boolean) program.eval();
485+ //
486+ // assertThat(result).isTrue();
487+ // }
488+
472489 private CelAbstractSyntaxTree compile (String expression ) throws Exception {
473490 CelAbstractSyntaxTree ast = CEL_COMPILER .parse (expression ).getAst ();
474491 if (isParseOnly ) {
0 commit comments