use of com.dexels.navajo.expression.compiled.ParameterNamesFunction in project navajo by Dexels.
the class TestCompiledExpression method testNestedNamedParams.
@Test
public void testNestedNamedParams() throws Exception {
FunctionInterface testFunction = new ParameterNamesFunction();
FunctionDefinition fd = new FunctionDefinition(testFunction.getClass().getName(), "description", "input", "result");
FunctionFactoryFactory.getInstance().addExplicitFunctionDefinition("ParameterNamesFunction", fd);
String expression = "ParameterNamesFunction(aap=1+1,noot=2+2)";
StringReader sr = new StringReader(expression);
CompiledParser cp = new CompiledParser(sr);
List<String> problems = new ArrayList<>();
cp.Expression();
ContextExpression ss = cp.getJJTree().rootNode().interpretToLambda(problems, sr.toString(), fn -> FunctionClassification.DEFAULT, name -> Optional.empty());
Assert.assertEquals("aap,noot", ss.apply().value);
}
Aggregations