Skip to content
Open
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
59 changes: 59 additions & 0 deletions tests/cql/CQLTimeZoneOffsetTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hl7.org/fhirpath/tests" xsi:schemaLocation="http://hl7.org/fhirpath/tests ../../testSchema/testSchema.xsd"
name="CQLTimeZoneOffsetTest" reference="https://cql.hl7.org/09-b-cqlreference.html#datetime-operators-2" version="1.4">
<capability code="timezone-offset"/>
<capability code="component-extraction"/>
<capability code="timezone-offset-policy.no-default-offset"/>
<group name="Policy: No default offset (preserve offset-less)" version="1.5">
<capability code="timezone-offset-policy.no-default-offset"/>
<test name="DateTimeEquality_NoDefaultOffset_NullWhenComparingOffsetlessToOffset" version="1.5">
<capability code="timezone-offset"/>
<capability code="component-extraction"/>
<capability code="timezone-offset-policy.no-default-offset"/><!-- Offset-less vs explicit UTC -->
<expression>@2020-01-01T12:00:00.000 = @2020-01-01T12:00:00.000+06:00</expression>
<output>null</output><!-- Bad test:: Depending on what “If no timezone offset is specified, the timezone offset of the evaluation request timestamp is used.” -->
</test>
<test name="TimezoneOffsetExtraction_NoDefaultOffset_ReturnsNull" version="1.5">
<capability code="timezone-offset"/>
<capability code="component-extraction"/>
<capability code="timezone-offset-policy.no-default-offset"/>
<!--
https://cql.hl7.org/02-authorsguide.html
Only DateTime values may specify a timezone offset, either as UTC (Z), or as a timezone offset. If no
timezone offset is specified, the timezone offset of the evaluation request timestamp is used.
Having true as expected is not correct with the current expression.
-->
<expression>timezoneoffset from @2012-04-01T00:00</expression>
<output>null</output><!-- Bad test:: Depending on what “If no timezone offset is specified, the timezone offset of the evaluation request timestamp is used.” -->
</test>
<test name="DateTimeOrdering_NoDefaultOffset_NullWhenOffsetlessVsOffset" version="1.5">
<capability code="timezone-offset"/>
<capability code="timezone-offset-policy.no-default-offset"/>
<expression>@2012-04-01T00:00 &lt; @2012-04-01T00:00+00:00</expression>
<output>null</output><!-- Bad test:: Depending on what “If no timezone offset is specified, the timezone offset of the evaluation request timestamp is used.” -->
</test>
</group>
<group name="Policy: Default to server offset (normalize offset-less to server)" version="1.5">
<capability code="timezone-offset-policy.default-server-offset"/>
<test name="TimezoneOffsetExtraction_DefaultServerOffset_MatchesServer" version="1.5">
<capability code="timezone-offset"/>
<capability code="component-extraction"/>
<capability code="timezone-offset-policy.default-server-offset"/>
<expression>(timezoneoffset from @2012-04-01T00:00) = (timezoneoffset from @2012-04-01T00:00{{SERVER_OFFSET_ISO}})</expression>
<output>true</output><!-- Bad test:: Depending on what “If no timezone offset is specified, the timezone offset of the evaluation request timestamp is used.” -->
</test>
<test name="DateTimeEquality_DefaultServerOffset_EqualsWhenExplicitServerOffsetGiven" version="1.5">
<capability code="timezone-offset"/>
<capability code="timezone-offset-policy.default-server-offset"/>
<expression>@2012-04-01T00:00 = @2012-04-01T00:00{{SERVER_OFFSET_ISO}}</expression>
<output>true</output>
</test>
<test name="DateTimeOrdering_DefaultServerOffset_Deterministic" version="1.5">
<capability code="timezone-offset"/>
<capability code="timezone-offset-policy.default-server-offset"/>
<!-- If both normalize to the same instant, < is false -->
<expression>@2012-04-01T00:00 &lt; @2012-04-01T00:00{{SERVER_OFFSET_ISO}}</expression>
<output>false</output>
</test>
</group>
</tests>
Loading