-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicate tests for aggregate functions, aggregate queries, an…
…d arithmetic functions (#1396) * Remove duplicate aggregate function tests * Remove duplicate aggregate query tests * Remove duplicate arithmetic function tests --------- Co-authored-by: JP <[email protected]>
- Loading branch information
Showing
9 changed files
with
201 additions
and
1,406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 80 additions & 21 deletions
101
Src/java/engine-fhir/src/test/resources/org/hl7/fhirpath/cql/CqlAggregateTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,88 @@ | ||
<?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"> | ||
name="CqlAggregateTest" reference="http://build.fhir.org/ig/HL7/cql/03-developersguide.html#aggregate-queries"> | ||
<group name="AggregateTests"> | ||
<test name="FactorialOfFive"> | ||
<expression>({ 1, 2, 3, 4, 5 }) Num aggregate Result starting 1: Result * Num</expression> | ||
<output>120</output> | ||
</test> | ||
<test name="RolledOutIntervals"> | ||
<expression>({ | ||
Interval[@2012-01-01, @2012-02-28], | ||
Interval[@2012-02-01, @2012-03-31], | ||
Interval[@2012-03-01, @2012-04-30] | ||
}) M | ||
aggregate R starting (null as List<Interval<DateTime>>): R union ({ | ||
M X | ||
let S: Max({ end of Last(R) + 1 day, start of X }), | ||
E: S + duration in days of X | ||
return Interval[S, E] | ||
})</expression> | ||
<output>{ | ||
Interval[@2012-01-01, @2012-02-28], | ||
Interval[@2012-02-29, @2012-04-28], | ||
Interval[@2012-04-29, @2012-06-28] | ||
}</output> | ||
<!-- Execution Error: Invalid precision: 1. --> | ||
</test> | ||
</group> | ||
<test name="RolledOutIntervals"> | ||
<expression> | ||
({ | ||
Interval[@2012-01-01, @2012-02-28], | ||
Interval[@2012-02-01, @2012-03-31], | ||
Interval[@2012-03-01, @2012-04-30] | ||
}) M | ||
aggregate R starting (null as List<Interval<DateTime>>): R union ({ | ||
M X | ||
let S: Max({ end of Last(R) + 1 day, start of X }), | ||
E: S + duration in days of X | ||
return Interval[S, E] | ||
}) | ||
</expression> | ||
<output> | ||
{ | ||
Interval[@2012-01-01, @2012-02-28], | ||
Interval[@2012-02-29, @2012-04-28], | ||
Interval[@2012-04-29, @2012-06-28] | ||
} | ||
</output> | ||
<!-- Execution Error: Invalid precision: 1. --> | ||
</test> | ||
<test name="AggregateSumWithStart"> | ||
<expression> | ||
({ 1, 2, 3, 4, 5 }) Num | ||
aggregate Result starting 1: Result + Num | ||
</expression> | ||
<output>16</output> | ||
<!-- 15 + 1 (the initial value) --> | ||
</test> | ||
<test name="AggregateSumWithNull"> | ||
<expression> | ||
({ 1, 2, 3, 4, 5 }) Num | ||
aggregate Result: Coalesce(Result, 0) + Num | ||
</expression> | ||
<output>15</output> | ||
<!-- 15 + 0 (the initial value from null) --> | ||
</test> | ||
<test name="AggregateSumAll"> | ||
<expression> | ||
({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num | ||
aggregate all Result: Coalesce(Result, 0) + Num | ||
</expression> | ||
<output>24</output> | ||
<!-- 24 + 0 --> | ||
</test> | ||
<test name="AggregateSumDistinct"> | ||
<expression> | ||
({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num | ||
aggregate distinct Result: Coalesce(Result, 0) + Num | ||
</expression> | ||
<output>15</output> | ||
<!-- 15 + 0 (the initial value) --> | ||
</test> | ||
<test name="Multi"> | ||
<expression> | ||
from ({1}) X, ({2}) Y, ({3}) Z | ||
aggregate Agg: Coalesce(Agg, 0) + X + Y + Z | ||
</expression> | ||
<output>6</output> | ||
</test> | ||
<test name="MegaMulti"> | ||
<expression> | ||
from ({1, 2}) X, ({1, 2}) Y, ({1, 2}) Z | ||
aggregate Agg starting 0: Agg + X + Y + Z | ||
</expression> | ||
<output>36</output> | ||
<!-- (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"> | ||
<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 | ||
</expression> | ||
<output>37</output> | ||
<!-- 1 + (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> | ||
</group> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.