Skip to content

Commit

Permalink
Fix list equality logic
Browse files Browse the repository at this point in the history
  • Loading branch information
antvaset committed Jul 23, 2024
1 parent 179c762 commit 96b04c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public static Object[][] dataMethod() {
"cql/CqlListOperatorsTest/Equivalent/Equivalent123AndABC",
"cql/CqlListOperatorsTest/Equivalent/Equivalent123AndString123",
"cql/CqlListOperatorsTest/Equivalent/EquivalentABCAnd123",
"cql/CqlListOperatorsTest/Flatten/FlattenListNullAndNull",
"cql/CqlListOperatorsTest/NotEqual/NotEqual123AndABC",
"cql/CqlListOperatorsTest/NotEqual/NotEqual123AndString123",
"cql/CqlListOperatorsTest/NotEqual/NotEqualABCAnd123",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<group name="Equal">
<test name="EqualNullNull">
<expression>{null} = {null}</expression>
<output>null</output>
<output>true</output>
</test>
<test name="EqualEmptyListNull">
<expression>{} as List&lt;String&gt; = null</expression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public static Boolean equal(Iterable<?> left, Iterable<?> right, State state) {
if (leftObject instanceof Iterable && rightObject instanceof Iterable) {
return equal((Iterable<?>) leftObject, (Iterable<?>) rightObject, state);
}
if (leftObject == null && rightObject == null) {
return true;
}
Boolean elementEquals = EqualEvaluator.equal(leftObject, rightObject, state);
if (elementEquals == null || !elementEquals) {
return elementEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void all_interval_operators() {
assertThat(((List<?>) value).size(), is(2));

value = results.forExpression("EqualNullNull").value();
assertThat(value, is(nullValue()));
assertThat(value, is(true));

value = results.forExpression("EqualEmptyListNull").value();
assertThat(value, is(nullValue()));
Expand Down

0 comments on commit 96b04c1

Please sign in to comment.