Deduplicate the conditional and date/time operator tests #1399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR deduplicates the conditional and date/time operator tests in this codebase.
Conditional operator tests
Removed
engine/.../CqlConditionalOperatorsTest.cql
, all tests already exist inCqlConditionalOperatorsTest.xml
.Date/time operator tests
Merged all tests from
engine/.../CqlDateTimeOperatorsTest.cql
intoCqlDateTimeOperatorsTest.xml
.Note that:
DateTimeComponentFromTimezone
test to expect it to raise a translation error due to the use of thetimezone
keyword which is no longer supported. Added the newDateTimeComponentFromTimezone2
test which uses the newtimezoneoffset
keyword. The CQL library was using thetimezoneoffset
keyword.TimeDurationBetweenHourDiffPrecision
test to expect it to raise a translation error due to the syntax error atZ
. Added the newTimeDurationBetweenHourDiffPrecision21 test which does not have
Z`, as in the CQL library.TimeSameOrBeforeHourFalse0
andTimeSameOrBeforeMillisTrue2
already existed inCqlDateTimeOperatorsTest.xml
asTimeSameOrBeforeHourTrue2
andTimeSameOrBeforeMillisFalse0
respectively.Issue34A
,TimeOfDayTest
, andIssue34B
tests because they should remain as Java-native tests.Note also that some of the library-based tests used the equivalence semantics when comparing the evaluation result against the expected result. E.g. for this define in the CQL library:
the Java test case was:
However the corresponding XML test case:
tests that this is CQL evaluates to true which uses the
=
operator`:I still consider these tests to be duplicates because the XML tests that we keep use the narrower semantics.
For all the tests that I added to the XML file that were missing, I used CVL in the output unless the test wasn't passing. For example this:
didn't pass but this did (both with the
=
and~
operators):so I used the equality operator in the expression for these tests (also for consistency with other existing XML tests).
Also, these tests exist both in the CQL library and XML file but have different expected values:
and the XML versions of these tests are currently skipped - something to look into in the future.
All additions to
CqlDateTimeOperatorsTest.xml
are mirrored in cqframework/cql-tests#47.