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

Fix list equality logic #1387

Merged
merged 7 commits into from
Jul 23, 2024
Merged

Conversation

antvaset
Copy link
Contributor

@antvaset antvaset commented Jul 23, 2024

This PR adds some fixes to the list equality logic.

  1. Remove the early return statement inside CqlList.equal leading to e.g. this being true: {{'a','b'}, 'c'} = {{'a','b'},'d'}. Added the EqualWithSubListsTrue and EqualWithSubListsFalse tests for this case.

  2. Fix null handling ("For list types, this means that equality returns true if and only if the lists contain elements of the same type, have the same number of elements, and for each element in the lists, in order, the elements are equal using equality semantics, with the exception that null elements are considered equal." - link). Added the EqualLiteralNull test to better cover this case.

  3. The EqualNullNull test (XML-based) is adjusted to match the spec. The same change is proposed in Fix expected output for the EqualNullNull test cql-tests#38.

  4. The test_Equal_BothListsHaveNull test (library-based) is also fixed to match the spec.

  5. Because our XML-based tests use CQL's equality semantics to compare the expected to actual value of test expressions, it's now possible to un-skip the FlattenListNullAndNull test which previously wasn't passing because { null, null } = { null, null } didn't evaluate to true.

@antvaset antvaset marked this pull request as draft July 23, 2024 07:29
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.69%. Comparing base (179c762) to head (f7238d5).

Files Patch % Lines
...s/cqf/cql/engine/elm/executing/EqualEvaluator.java 50.00% 0 Missing and 1 partial ⚠️
...va/org/opencds/cqf/cql/engine/runtime/CqlList.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1387      +/-   ##
============================================
- Coverage     63.69%   63.69%   -0.01%     
  Complexity     2666     2666              
============================================
  Files           492      492              
  Lines         27738    27738              
  Branches       5511     5511              
============================================
- Hits          17669    17668       -1     
  Misses         7828     7828              
- Partials       2241     2242       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@antvaset antvaset marked this pull request as ready for review July 23, 2024 09:17
@JPercival JPercival merged commit b537d07 into cqframework:master Jul 23, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants