Skip to content

Add comparison operator tests#45

Open
antvaset wants to merge 9 commits intocqframework:mainfrom
antvaset:comparison-operator-tests
Open

Add comparison operator tests#45
antvaset wants to merge 9 commits intocqframework:mainfrom
antvaset:comparison-operator-tests

Conversation

@antvaset
Copy link
Contributor

@antvaset antvaset commented Aug 9, 2024

This PR adds new conformance tests for comparison operators. I picked all the ones from https://github.com/cqframework/clinical_quality_language/blob/dfafdb9/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlComparisonOperatorsTest.cql which didn't exist yet here.

Copy link
Contributor

@evan-gordon evan-gordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, happy to approve this once they're addressed.

<output>false</output>
</test>
<test name="SimpleEqInt1Int2Long">
<expression>10L = 20L</expression>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test name implies that the left argument should be 10 not 10L no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @evan-gordon I changed the name to SimpleEqLong1Long2 and expression to 1L = 2L. It's now cleaner and consistent with Int1, Int2 elsewhere in the file.

The tests in https://github.com/cqframework/clinical_quality_language/blob/dfafdb9/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlComparisonOperatorsTest.cql can later be updated to match this.

<expression>1'cm':2'cm' = 1'cm':2'cm'</expression>
<output>true</output>
</test>
<test name="RatioNotEqual">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the numerators aren't equal, might be worth adding a case for denominators as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replaced this with two tests: RatioNotEqualDiffNumerator and RatioNotEqualDiffDenominator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for RatioNotEquivalent tests

<expression>0 &gt; 1</expression>
<output>false</output>
</test>
<test name="GreaterLong">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GreeaterLongFalse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are many tests in this file with false as expected value, yet they don't have False in the test name. See also https://github.com/cqframework/clinical_quality_language/blob/dfafdb9/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlComparisonOperatorsTest.cql .

<output>true</output>
</test>
<test name="SimpleNotEqInt1Int2Long">
<expression>10L != 20L</expression>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my above comment, shouldn't the left argument be an int given this test name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name to SimpleNotEqLong1Long2 and expression to 1L != 2L

@antvaset antvaset requested a review from evan-gordon February 6, 2026 03:14
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