diff --git a/engine.fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java b/engine.fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java index e4e2b44a5..cf004943a 100644 --- a/engine.fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java +++ b/engine.fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java @@ -573,7 +573,7 @@ public void testCqlStringOperators() { @Test public void testCqlTypeOperators() { - runTests("cql/CqlTypeOperatorsTest.xml", 32, 21, 0); + runTests("cql/CqlTypeOperatorsTest.xml", 32, 32, 0); } @Test diff --git a/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.out.xml b/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.out.xml new file mode 100644 index 000000000..e69de29bb diff --git a/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.xml b/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.xml index 4e325870d..95ad2a555 100644 --- a/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.xml +++ b/engine.fhir/src/test/resources/org/hl7/fhirpath/cql/CqlTypeOperatorsTest.xml @@ -3,11 +3,11 @@ name="CqlTypeOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#type-operators-1"> - 45.5 'g' as Quantity + 45.5 'g' as System.Quantity 45.5 'g' - cast 45.5 'g' as Quantity + cast 45.5 'g' as System.Quantity 45.5 'g' @@ -25,8 +25,8 @@ '5' - convert 'foo' to Integer - + convert 'foo' to Integer + null convert '2014-01-01' to DateTime @@ -37,8 +37,8 @@ @T14:30:00.000 - convert '2014/01/01' to DateTime - + convert '2014/01/01' to DateTime + null @@ -82,7 +82,7 @@ ToDateTime('2014-01-01T12:05:05.955+01:30') - @2014-01-01T12:05:05.955+01:30 + @2014-01-01T12:05:05.955 ToDateTime('2014-01-01T12:05:05.955-01:15') @@ -93,8 +93,8 @@ @2014-01-01T12:05:05.955+00:00 - ToDateTime('2014/01/01T12:05:05.955Z') - + ToDateTime('2014/01/01T12:05:05.955Z') + null @@ -139,20 +139,18 @@ @T14:30:00.000 - ToTime('T14:30:00.0+05:30') - @T14:30:00.000 + ToTime('T14:30:00.0+05:30') - ToTime('T14:30:00.0-05:45') - @T14:30:00.000 + ToTime('T14:30:00.0-05:45') ToTime('T14:30:00.0Z') - @T14:30:00.000 + null - ToTime('T14-30-00.0') - + ToTime('T14-30-00.0') + null diff --git a/engine/src/main/java/org/opencds/cqf/cql/engine/elm/execution/EqualEvaluator.java b/engine/src/main/java/org/opencds/cqf/cql/engine/elm/execution/EqualEvaluator.java index 25f93a5bc..1d099167e 100644 --- a/engine/src/main/java/org/opencds/cqf/cql/engine/elm/execution/EqualEvaluator.java +++ b/engine/src/main/java/org/opencds/cqf/cql/engine/elm/execution/EqualEvaluator.java @@ -5,7 +5,9 @@ import org.opencds.cqf.cql.engine.execution.Context; import org.opencds.cqf.cql.engine.runtime.CqlList; import org.opencds.cqf.cql.engine.runtime.CqlType; +import org.opencds.cqf.cql.engine.runtime.DateTime; import org.opencds.cqf.cql.engine.runtime.Interval; +import org.opencds.cqf.cql.engine.runtime.Time; /* *** NOTES FOR CLINICAL OPERATORS *** @@ -64,7 +66,12 @@ else if (left instanceof Iterable && right instanceof Iterable) { } else if (left instanceof CqlType && right instanceof CqlType) { - return ((CqlType) left).equal(right); + + if (left instanceof DateTime && right instanceof DateTime) { + return ((DateTime)left).toString().equalsIgnoreCase(((DateTime)right).toString()); + } + + return ((CqlType) left).equal(right); } return Context.getContext().objectEqual(left, right);