update tests
This commit is contained in:
parent
a52e209706
commit
61f338991d
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<tests>
|
||||
<!-- Some tests thrown in by Brian -->
|
||||
<group name="Patient tests">
|
||||
|
@ -38,7 +38,7 @@
|
|||
</test>
|
||||
|
||||
<!-- test(patient(), "name.\"given\"", 3, "string"); -->
|
||||
<test name="testSimpleBackTick" inputfile="patient-example.xml">
|
||||
<test name="testEscapedIdentifier" inputfile="patient-example.xml">
|
||||
<expression>name.`given`</expression>
|
||||
<output type="string">Peter</output>
|
||||
<output type="string">James</output>
|
||||
|
@ -261,11 +261,11 @@
|
|||
<test name="testEmpty" inputfile="patient-example.xml"><expression>Patient.name.empty().not()</expression><output type="boolean">true</output></test>
|
||||
<test name="testEmpty" inputfile="patient-example.xml"><expression>Patient.link.empty()</expression><output type="boolean">true</output></test>
|
||||
|
||||
<test name="testLiteralDate" inputfile="patient-example.xml"><expression>true.not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testLiteralDate" inputfile="patient-example.xml"><expression>false.not() = true</expression><output type="boolean">true</output></test>
|
||||
<test name="testLiteralDate" inputfile="patient-example.xml"><expression>(0).not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testLiteralDate" inputfile="patient-example.xml"><expression>(1).not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testLiteralDate" inputfile="patient-example.xml"><expression>(1|2).not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testNot" inputfile="patient-example.xml"><expression>true.not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testNot" inputfile="patient-example.xml"><expression>false.not() = true</expression><output type="boolean">true</output></test>
|
||||
<test name="testNot" inputfile="patient-example.xml"><expression>(0).not() = true</expression><output type="boolean">true</output></test>
|
||||
<test name="testNot" inputfile="patient-example.xml"><expression>(1).not() = false</expression><output type="boolean">true</output></test>
|
||||
<test name="testNot" inputfile="patient-example.xml"><expression invalid="semantic">(1|2).not() = false</expression></test>
|
||||
</group>
|
||||
|
||||
<group name="testTypes">
|
||||
|
@ -367,7 +367,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>Patient.name.select(period.exists()).allTrue()</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>Patient.name.all(given.exists())</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>Patient.name.all(period.exists())</expression><output type="boolean">false</output></test>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testSubSetOf">
|
||||
<test inputfile="patient-example.xml"><expression>Patient.name.first().subsetOf($this.name)</expression><output type="boolean">true</output></test>
|
||||
|
@ -394,7 +394,7 @@
|
|||
</group>
|
||||
|
||||
<group name="testCollectionBoolean">
|
||||
<test inputfile="patient-example.xml"><expression>iif(1 | 2 | 3, true, false)</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression invalid="semantic">iif(1 | 2 | 3, true, false)</expression></test>
|
||||
<test inputfile="patient-example.xml"><expression>iif({}, true, false)</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>iif(true, true, false)</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>iif({} | true, true, false)</expression><output type="boolean">true</output></test>
|
||||
|
@ -647,12 +647,12 @@
|
|||
<test inputfile="patient-example.xml"><expression>name.take(2) != name.take(2).first() | name.take(2).last()</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>name.take(2) != name.take(2).last() | name.take(2).first()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value != 185 'kg'</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testEquivalent">
|
||||
<test inputfile="patient-example.xml"><expression>1 ~ 1</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>{} ~ {}</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 ~ {}</expression></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 ~ {}</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 ~ 2</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>'a' ~ 'a'</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>'a' ~ 'A'</expression><output type="boolean">true</output></test>
|
||||
|
@ -674,7 +674,7 @@
|
|||
<group name="testNotEquivalent">
|
||||
<test inputfile="patient-example.xml"><expression>1 !~ 1</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>{} !~ {}</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>{} !~ 1</expression></test>
|
||||
<test inputfile="patient-example.xml"><expression>{} !~ 1</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 !~ 2</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>'a' !~ 'a'</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>'a' !~ 'A'</expression><output type="boolean">false</output></test>
|
||||
|
@ -692,7 +692,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>name.take(2).given !~ name.take(2).last().given | name.take(2).first().given</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value !~ 185 'kg'</expression><output type="boolean">true</output></test>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testLessThan">
|
||||
<test inputfile="patient-example.xml"><expression>1 < 2</expression><output type="boolean">true</output></test>
|
||||
|
@ -720,7 +720,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>@T12:00:01 < @T12:00:00</expression><output type="boolean">false</output></test>
|
||||
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value < 200 '[lb_av]'</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testLessOrEqual">
|
||||
<test inputfile="patient-example.xml"><expression>1 <= 2</expression><output type="boolean">true</output></test>
|
||||
|
@ -747,7 +747,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>@2014-12-13T12:00:01 <= @2014-12-13T12:00:00</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>@T12:00:01 <= @T12:00:00</expression><output type="boolean">false</output></test>
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value <= 200 '[lb_av]'</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testGreatorOrEqual">
|
||||
<test inputfile="patient-example.xml"><expression>1 >= 2</expression><output type="boolean">false</output></test>
|
||||
|
@ -775,7 +775,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>@T12:00:01 >= @T12:00:00</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value >= 100 '[lb_av]'</expression><output type="boolean">true</output></test>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testGreaterThan">
|
||||
<test inputfile="patient-example.xml"><expression>1 > 2</expression><output type="boolean">false</output></test>
|
||||
|
@ -802,7 +802,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>@2014-12-13T12:00:01 > @2014-12-13T12:00:00</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>@T12:00:01 > @T12:00:00</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="observation-example.xml"><expression>Observation.value > 100 '[lb_av]'</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group name="testUnion">
|
||||
<test inputfile="patient-example.xml"><expression>(1 | 2 | 3).count() = 3</expression><output type="boolean">true</output></test>
|
||||
|
@ -884,7 +884,6 @@
|
|||
<test inputfile="patient-example.xml"><expression>({} xor false).empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>({} xor {}).empty()</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
|
||||
|
||||
<group name="testBooleanImplies">
|
||||
<test inputfile="patient-example.xml"><expression>(true implies true) = true</expression><output type="boolean">true</output></test>
|
||||
|
@ -895,7 +894,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>(false implies false) = true</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>(false implies {}) = true</expression><output type="boolean">true</output></test>
|
||||
|
||||
<test inputfile="patient-example.xml"><expression>({} implies true).empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>({} implies true) = true</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>({} implies false).empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>({} implies {}).empty()</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
|
@ -909,8 +908,8 @@
|
|||
|
||||
<group name="testConcatenate">
|
||||
<test inputfile="patient-example.xml"><expression>'a' & 'b' = 'ab'</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>('1' & {}).empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>({} & 'b').empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>'1' & {} = '1'</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>{} & 'b' = 'b'</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression invalid="semantic">(1 | 2 | 3) & 'b' = '1,2,3b'</expression></test>
|
||||
</group>
|
||||
|
||||
|
@ -932,7 +931,7 @@
|
|||
<test inputfile="patient-example.xml"><expression>4 / 2 = 2</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>4.0 / 2.0 = 2.0</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 / 2 = 0.5</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1.2 / 1.8 = 0.67</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1.2 / 1.8 = 0.67</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
|
||||
<group name="testDiv">
|
||||
|
@ -956,7 +955,7 @@
|
|||
<!-- should error because unary does not work on boolean: -(1.convertsToInteger()) -->
|
||||
</test>
|
||||
|
||||
<test inputfile="patient-example.xml"><expression>1+2*3+4 = 11</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1+2*3+4 = 11</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 > 2 is Boolean</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression>1 | 1 is Integer</expression><output type="boolean">true</output></test>
|
||||
</group>
|
||||
|
@ -1006,5 +1005,12 @@
|
|||
<test inputfile="patient-example.xml"><expression invalid="true">conformsTo('http://trash')</expression></test>
|
||||
</group>
|
||||
|
||||
<!--
|
||||
<group name="testDollarResource">
|
||||
testBoolean(patient(), patient().getManagingOrganization(), "Reference", "reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))</expression><output type="boolean">true</output></test>
|
||||
testBoolean(patient(), patient(), "Patient", "contained.select(('#'+id in %resource.descendants().reference).not()).empty()</expression><output type="boolean">true</output></test>
|
||||
<test inputfile="patient-example.xml"><expression invalid="true">contained.select(('#'+id in %resource.descendants().reference).not()).empty()");
|
||||
</group>
|
||||
-->
|
||||
</tests>
|
||||
|
||||
|
|
|
@ -1827,6 +1827,78 @@
|
|||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t38-dt"/>
|
||||
<url value="http://example.org/fhir/StructureDefinition/profile-duration"/>
|
||||
<name value="t38-dt"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #38-dt: Deep nesting"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Duration"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Duration"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Duration"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Duration.value"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Duration.unit"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Duration.system"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Duration.code"/>
|
||||
<binding>
|
||||
<strength value="extensible"/>
|
||||
<valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/prescribedquantityunit"/>
|
||||
</binding>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t38"/>
|
||||
<url value="urn:uuid:00d940df-0e4f-40db-8051-252901d659e4"/>
|
||||
<name value="t38"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #38: Deep nesting"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="MedicationRequest"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationRequest"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="MedicationRequest"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="MedicationRequest.dosageInstruction"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="MedicationRequest.dosageInstruction.timing"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="MedicationRequest.dosageInstruction.timing.repeat"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="MedicationRequest.dosageInstruction.timing.repeat.bounds[x]"/>
|
||||
<type>
|
||||
<code value="Duration"/>
|
||||
<profile value="http://example.org/fhir/StructureDefinition/profile-duration"/>
|
||||
</type>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
<url value="http://hl7.org/fhir/tests/snapshotgeneration"/>
|
||||
<name value="SnapshotGenerationTests"/>
|
||||
<title value="Snapshot generation test script"/>
|
||||
|
@ -2178,9 +2250,9 @@
|
|||
<action>
|
||||
<assert>
|
||||
<label value="test9-1"/>
|
||||
<description value="Mustsupport must be true on Patient.identifier"/>
|
||||
<description value="Mustsupport must not be true on Patient.identifier"/>
|
||||
<direction value="response"/>
|
||||
<expression value="fixture('t9o').snapshot.element.where(path = 'Patient.identifier').mustSupport.not()"/>
|
||||
<expression value="fixture('t9o').snapshot.element.where(path = 'Patient.identifier').mustSupport.empty()"/>
|
||||
<warningOnly value="false"/>
|
||||
</assert>
|
||||
</action>
|
||||
|
@ -3514,10 +3586,7 @@
|
|||
<warningOnly value="false"/>
|
||||
</assert>
|
||||
</action>
|
||||
</test>
|
||||
<!--
|
||||
this triggers a complex bug in the snapshot generation to do with tracking paths when repeatedly walking across recursion (contentReference != null)
|
||||
|
||||
</test>
|
||||
<test>
|
||||
<name value="Test36"/>
|
||||
<description value="Test deep nesting"/>
|
||||
|
@ -3544,5 +3613,30 @@
|
|||
</assert>
|
||||
</action>
|
||||
</test>
|
||||
-->
|
||||
<test>
|
||||
<name value="Test38"/>
|
||||
<description value="Test deep nesting"/>
|
||||
<action>
|
||||
<operation>
|
||||
<type>
|
||||
<system value="http://hl7.org/fhir/testscript-operation-codes"/>
|
||||
<code value="snapshot"/>
|
||||
</type>
|
||||
<resource value="StructureDefinition"/>
|
||||
<encodeRequestUrl value="false"/>
|
||||
<params value="sort=true"/>
|
||||
<responseId value="t38o"/>
|
||||
<sourceId value="t38"/>
|
||||
</operation>
|
||||
</action>
|
||||
<action>
|
||||
<assert>
|
||||
<label value="test38"/>
|
||||
<description value="Snapshot generation didn't blow up"/>
|
||||
<direction value="response"/>
|
||||
<expression value="fixture('t38o').snapshot.element.count() > 0"/>
|
||||
<warningOnly value="false"/>
|
||||
</assert>
|
||||
</action>
|
||||
</test>
|
||||
</TestScript>
|
||||
|
|
|
@ -389,7 +389,7 @@ public class SnapShotGenerationTests {
|
|||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), r);
|
||||
}
|
||||
|
||||
private StructureDefinition getSD(String url) throws DefinitionException, FHIRException {
|
||||
private StructureDefinition getSD(String url) throws DefinitionException, FHIRException, IOException {
|
||||
StructureDefinition sd = context.snapshots.get(url);
|
||||
if (sd == null)
|
||||
sd = findContainedProfile(url);
|
||||
|
@ -398,7 +398,7 @@ public class SnapShotGenerationTests {
|
|||
return sd;
|
||||
}
|
||||
|
||||
private StructureDefinition findContainedProfile(String url) throws DefinitionException, FHIRException {
|
||||
private StructureDefinition findContainedProfile(String url) throws DefinitionException, FHIRException, IOException {
|
||||
for (Resource r : context.tests.getContained()) {
|
||||
if (r instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) r;
|
||||
|
@ -411,6 +411,7 @@ public class SnapShotGenerationTests {
|
|||
if (!errors.isEmpty())
|
||||
throw new FHIRException(errors.get(0));
|
||||
pu.generateSnapshot(getSD(p.getBaseDefinition()), p, p.getUrl(), p.getName());
|
||||
debugSaveResource(p);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue