gitgabrio commented on code in PR #5645:
URL:
https://github.com/apache/incubator-kie-drools/pull/5645#discussion_r1450238057
##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/FEELFunctionsTest.java:
##########
@@ -237,6 +237,12 @@ public static Collection<Object[]> data() {
{ "{a: -2, r: -sum( 1, -abs(a), 3 )}.r", BigDecimal.valueOf(
-2 ) , null},
{ "if list contains ([2.2, 3.0, 4.0], 3) then \"OK\" else
\"NOT_OK\"", "OK" , null},
{ "if list contains ([2.2, 3, 4], 3.000) then \"OK\" else
\"NOT_OK\"", "OK" , null},
+ {"list replace ( null, 3, 6)", null ,
FEELEvent.Severity.ERROR},
+ {"list replace ( [2, 4, 7, 8], null, 6)", null ,
FEELEvent.Severity.ERROR},
+ {"list replace ( [2, 4, 7, 8], 3, 6)",
Arrays.asList(BigDecimal.valueOf(2), BigDecimal.valueOf(4),
BigDecimal.valueOf(6), BigDecimal.valueOf(8)), null},
+ {"list replace ( [2, 4, 7, 8], function(item, newItem) item +
newItem, 6)", null , FEELEvent.Severity.ERROR},
+ {"list replace ( [\"El-1\", \"El-2\", \"El-3\", \"El-4\"],
function(item, newItem) item = \"El-2\", null)", Arrays.asList("El-1", null,
"El-3", "El-4"), null},
+ {"list replace ( [2, 4, 7, 8], function(item, newItem) item <
newItem, 5)", Arrays.asList(BigDecimal.valueOf(5), BigDecimal.valueOf(5),
BigDecimal.valueOf(7), BigDecimal.valueOf(8)), null}
Review Comment:
@tarilabs
This is from spec:
`[..] return a new list where newItem replaced at all positions where the
match function returned true`
with example
`list replace ( [2, 4, 7, 8], function(item, newItem) item < newItem, 5) =
[5, 5, 7, 8]`
so, I get it as "replace all elements where the match is true" - in the
given example: replace all items that are less then 5: does this make sense ?
Is that what you meant ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]