Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type conversion operator tests for malformed inputs. Enable tests for Boolean and null literals. #1371

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,19 @@ public static Object[][] dataMethod() {
"cql/CqlStringOperatorsTest/toString tests/DateTimeToString3",
"cql/CqlTypeOperatorsTest/As/AsQuantity",
"cql/CqlTypeOperatorsTest/As/CastAsQuantity",
"cql/CqlTypeOperatorsTest/Convert/StringToDateTimeMalformed",
"cql/CqlTypeOperatorsTest/Convert/StringToIntegerError",
"cql/CqlTypeOperatorsTest/ToDateTime/ToDateTimeDate",
"cql/CqlTypeOperatorsTest/ToDateTime/ToDateTimeMalformed",
"cql/CqlTypeOperatorsTest/ToDateTime/ToDateTimeTimeUnspecified",
"cql/CqlTypeOperatorsTest/ToTime/ToTime2",
"cql/CqlTypeOperatorsTest/ToTime/ToTime3",
"cql/CqlTypeOperatorsTest/ToTime/ToTime4",
"cql/CqlTypeOperatorsTest/ToTime/ToTimeMalformed",
"cql/CqlTypesTest/DateTime/DateTimeUncertain",
"cql/CqlTypesTest/Time/TimeUpperBoundMillis",
"cql/ValueLiteralsAndSelectors/Boolean/BooleanFalse",
"cql/ValueLiteralsAndSelectors/Boolean/BooleanTrue",
"cql/ValueLiteralsAndSelectors/Decimal/Decimal10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalNeg10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalNegTenthStep",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalPos10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalPosTenthStep",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalTenthStep",
"cql/ValueLiteralsAndSelectors/Null/Null",
"r4/tests-fhir-r4/from-Zulip/(true and 'foo').empty()",
"r4/tests-fhir-r4/from-Zulip/(true | 'foo').allTrue()",
"r4/tests-fhir-r4/testAggregate/testAggregate1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ protected void runTest(
String outputExpression = test.getOutput().get(0).getValue();
if ("null".equals(outputExpression)) {
cql = String.format("%s (%s) is %s", cql, testExpression, outputExpression);
} else if ("null".equals(testExpression)) {
cql = String.format("%s (%s) is %s", cql, outputExpression, testExpression);
} else {
cql = String.format("%s (%s) = %s", cql, testExpression, outputExpression);
cql = String.format("%s (%s) = (%s)", cql, testExpression, outputExpression);
}
} else {
cql = String.format("%s %s", cql, testExpression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<output>'5'</output>
</test>
<test name="StringToIntegerError">
<expression invalid="true">convert 'foo' to Integer</expression>
<!-- EXPECT: Unable to convert given string to Integer -->
<expression>convert 'foo' to Integer</expression>
<output>null</output>
</test>
<test name="StringToDateTime">
<expression>convert '2014-01-01' to DateTime</expression>
Expand All @@ -37,8 +37,8 @@
<output>@T14:30:00.000</output>
</test>
<test name="StringToDateTimeMalformed">
<expression invalid="true">convert '2014/01/01' to DateTime</expression>
<!-- EXPECT: Invalid format: "2014/01/01" is malformed at "/01/01" -->
<expression>convert '2014/01/01' to DateTime</expression>
<output>null</output>
</test>
</group>
<group name="Is">
Expand Down Expand Up @@ -93,8 +93,8 @@
<output>@2014-01-01T12:05:05.955+00:00</output>
</test>
<test name="ToDateTimeMalformed">
<expression invalid="true">ToDateTime('2014/01/01T12:05:05.955Z')</expression>
<!-- EXPECT: Invalid format: "2014/01/01T12:05:05.955" is malformed at "/01/01T12:05:05.955" -->
<expression>ToDateTime('2014/01/01T12:05:05.955Z')</expression>
<output>null</output>
</test>
<test name="ToDateTimeDate">
<expression>ToDateTime(@2014-01-01)</expression>
Expand Down Expand Up @@ -159,8 +159,8 @@
<output>@T14:30:00.000</output>
</test>
<test name="ToTimeMalformed">
<expression invalid="true">ToTime('T14-30-00.0')</expression>
<!-- EXPECT: Invalid format: "T14-30-00.0" is malformed at "-30-00.0" -->
<expression>ToTime('T14-30-00.0')</expression>
<output>null</output>
</test>
</group>
</tests>
Loading