Skip to content
Closed
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions tests/cql/CqlAggregateFunctionsTest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?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="CqlAggregateFunctionsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#aggregate-functions" version="1.5">
<capability code="aggregate-functions"/>
<group name="AllTrue" version="1.5">
<test name="AllTrueAllTrue" version="1.5">
<expression>AllTrue({true,true})</expression>
Expand Down Expand Up @@ -85,6 +86,7 @@
</group>
<group name="Product" version="1.5">
<test name="ProductLong" version="1.5">
<capability code="system.long"/>
<expression>Product({5L, 4L, 5L})</expression>
<output>100L</output>
</test>
Expand All @@ -95,10 +97,12 @@
<output>4</output>
</test>
<test name="CountTestDateTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Count({ DateTime(2014), DateTime(2001), DateTime(2010) })</expression>
<output>3</output>
</test>
<test name="CountTestTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Count({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 })</expression>
<output>3</output>
</test>
Expand All @@ -113,6 +117,7 @@
<output>90</output>
</test>
<test name="MaxTestLong" version="1.5">
<capability code="system.long"/>
<expression>Max({ 5L, 12L, 1L, 15L, 0L, 4L, 90L, 44L })</expression>
<output>90L</output>
</test>
Expand All @@ -121,10 +126,12 @@
<output>'zebra'</output>
</test>
<test name="MaxTestDateTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Max({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6) })</expression>
<output>@2012-10-06T</output>
</test>
<test name="MaxTestTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Max({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 })</expression>
<output>@T20:59:59.999</output>
</test>
Expand All @@ -141,6 +148,7 @@
<output>0</output>
</test>
<test name="MinTestLong" version="1.5">
<capability code="system.long"/>
<expression>Min({5L, 12L, 1L, 15L, 0L, 4L, 90L, 44L})</expression>
<output>0L</output>
</test>
Expand All @@ -149,10 +157,12 @@
<output>'bye'</output>
</test>
<test name="MinTestDateTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Min({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6) })</expression>
<output>@2012-09-05T</output>
</test>
<test name="MinTestTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Min({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 })</expression>
<output>@T05:59:59.999</output>
</test>
Expand All @@ -163,14 +173,17 @@
<output>9</output>
</test>
<test name="ModeTestDateTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Mode({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6), DateTime(2012, 9, 5) })</expression>
<output>@2012-09-05T</output>
</test>
<test name="ModeTestDateTime2" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Mode({ DateTime(2012, 10, 5), DateTime(2012, 10, 5), DateTime(2012, 10, 6), DateTime(2012, 9, 5) })</expression>
<output>@2012-10-05T</output>
</test>
<test name="ModeTestTime" version="1.5">
<capability code="date-and-time-operators"/>
<expression>Mode({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999, @T05:59:59.999 })</expression>
<output>@T05:59:59.999</output>
</test>
Expand Down Expand Up @@ -213,10 +226,12 @@
<output>20.0</output>
</test>
<test name="SumTestLong" version="1.5">
<capability code="system.long"/>
<expression>Sum({ 6L, 2L, 3L, 4L, 5L })</expression>
<output>20L</output>
</test>
<test name="SumTestQuantity" version="1.5">
<capability code="unit-conversion-support"/>
<expression>Sum({1 'ml',2 'ml',3 'ml',4 'ml',5 'ml'})</expression>
<output>15 'ml'</output>
</test>
Expand Down
20 changes: 20 additions & 0 deletions tests/cql/CqlAggregateTest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?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="CqlAggregateTest" reference="http://build.fhir.org/ig/HL7/cql/03-developersguide.html#aggregate-queries" version="1.5">
<capability code="aggregate-clause-query"/>
<group name="AggregateTests" version="1.5">
<capability code="aggregate-clause-query"/>
<test name="FactorialOfFive" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>({ 1, 2, 3, 4, 5 }) Num aggregate Result starting 1: Result * Num</expression>
<output>120</output>
</test>
<test name="RolledOutIntervals" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
({
Interval[@2012-01-01, @2012-02-28],
Expand All @@ -30,6 +36,8 @@
<!-- Execution Error: Invalid precision: 1. -->
</test>
<test name="AggregateSumWithStart" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
({ 1, 2, 3, 4, 5 }) Num
aggregate Result starting 1: Result + Num
Expand All @@ -38,6 +46,8 @@
<!-- 15 + 1 (the initial value) -->
</test>
<test name="AggregateSumWithNull" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
({ 1, 2, 3, 4, 5 }) Num
aggregate Result: Coalesce(Result, 0) + Num
Expand All @@ -46,6 +56,8 @@
<!-- 15 + 0 (the initial value from null) -->
</test>
<test name="AggregateSumAll" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num
aggregate all Result: Coalesce(Result, 0) + Num
Expand All @@ -54,6 +66,8 @@
<!-- 24 + 0 -->
</test>
<test name="AggregateSumDistinct" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num
aggregate distinct Result: Coalesce(Result, 0) + Num
Expand All @@ -62,13 +76,17 @@
<!-- 15 + 0 (the initial value) -->
</test>
<test name="Multi" version="1.5">
<capability code="single-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
from ({1}) X, ({2}) Y, ({3}) Z
aggregate Agg: Coalesce(Agg, 0) + X + Y + Z
</expression>
<output>6</output>
</test>
<test name="MegaMulti" version="1.5">
<capability code="multi-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
from ({1, 2}) X, ({1, 2}) Y, ({1, 2}) Z
aggregate Agg starting 0: Agg + X + Y + Z
Expand All @@ -77,6 +95,8 @@
<!-- (1+1+1)+(1+1+2)+(1+2+1)+(1+2+2)+(2+1+1)+(2+1+2)+(2+2+1)+(2+2+2) -->
</test>
<test name="MegaMultiDistinct" version="1.5">
<capability code="multi-source-query"/>
<capability code="aggregate-clause-query"/>
<expression>
from ({1, 2, 2, 1}) X, ({1, 2, 1, 2}) Y, ({2, 1, 2, 1}) Z
aggregate distinct Agg starting 1: Agg + X + Y + Z
Expand Down
Loading