Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-issues#1744] Don't fail a range comparison in FEEL when a unary test range is used #6231

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -680,6 +681,7 @@ void decisionTableOutputMessageRowIndex(boolean useExecModelCompiler) {

@ParameterizedTest
@MethodSource("params")
@Disabled("Disabled due to required clarifications on DMN specs")
void dTand(boolean useExecModelCompiler) {
init(useExecModelCompiler);
final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("DTand.dmn", this.getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ public BaseNode visitInterval(FEEL_1_1Parser.IntervalContext ctx) {
public BaseNode visitPositiveUnaryTestIneq(FEEL_1_1Parser.PositiveUnaryTestIneqContext ctx) {
BaseNode value = visit( ctx.endpoint() );
String op = ctx.op.getText();
return ASTBuilderFactory.newUnaryTestNode( ctx, op, value );
UnaryOperator unaryOperator = UnaryOperator.determineOperator(op);
return unaryOperator.equals(UnaryOperator.EQ) ? ASTBuilderFactory.newIntervalNode(ctx, RangeNode.IntervalBoundary.CLOSED, value, value, RangeNode.IntervalBoundary.CLOSED) :
ASTBuilderFactory.newUnaryTestNode( ctx, op, value );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected void instanceTest(String expression, Object result, FEELEvent.Severity
private static Collection<Object[]> data() {
final Object[][] cases = new Object[][]{
// when converting from unary tests, boundaries are dictated by comparison
{"(=1)", new RangeImpl(Range.RangeBoundary.CLOSED, BigDecimal.ONE, BigDecimal.ONE, Range.RangeBoundary.CLOSED), null},
{"(>1)", new RangeImpl(Range.RangeBoundary.OPEN, BigDecimal.ONE, new UndefinedValueComparable(), Range.RangeBoundary.OPEN), null},
{"(>=1)", new RangeImpl(Range.RangeBoundary.CLOSED, BigDecimal.ONE, new UndefinedValueComparable(), Range.RangeBoundary.OPEN), null},
{"(<1)", new RangeImpl(Range.RangeBoundary.OPEN, new UndefinedValueComparable(), BigDecimal.ONE, Range.RangeBoundary.OPEN), null},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ private static Collection<Object[]> data() {
{ "false != false", Boolean.FALSE , null},
{ "false != true", Boolean.TRUE , null},
{ "true != false", Boolean.TRUE , null},

// other comparisons
{ "duration(\"P1Y\") < duration(\"P2Y\")", Boolean.TRUE , null},
{ "duration(\"P1Y\") > duration(\"P2Y\")", Boolean.FALSE , null},

// other types of equalities
{ "[ 1..3 ] = [ 1..3 ]", Boolean.TRUE , null},
{ "(=10) = (=10)", Boolean.TRUE , null},
{ "[ \"1\"..\"3\" ] = [ \"1\"..\"3\" ]", Boolean.TRUE , null},
{ "[\"1978-09-12\"..\"1978-10-12\"] = [\"1978-09-12\"..\"1978-10-12\"]", Boolean.TRUE, null},
{ "[ 1, 2, 3] = [1, 2, 3]", Boolean.TRUE , null},
Expand Down Expand Up @@ -107,12 +108,12 @@ private static Collection<Object[]> data() {
{ "null = null", Boolean.TRUE , null},
{ "null != null", Boolean.FALSE , null},

// RHDM-1119
// RHDM-1119
{ "{ m: <18 }.m(16)", true, null}, // Working expression, for the expr raising compilation Warn test have been moved.
{ "{list : 1, r: list < 3}.r", Boolean.TRUE , null}, // strange name for a number literal, intended this way.
{ "{list : 1, r: list< 3}.r", Boolean.TRUE , null},
{ "{list : 1, r: list< 3}.r", Boolean.TRUE , null},
{ "{context : 1, r: context < 3}.r", Boolean.TRUE , null}, // strange name for a number literal, intended this way.
{ "{context : 1, r: context< 3}.r", Boolean.TRUE , null},
{ "{context : 1, r: context< 3}.r", Boolean.TRUE , null},
};
return addAdditionalParameters(cases, false);
}
Expand Down
Loading