Skip to content

Specification Test Nonconformity & Notes

Evan Machusak edited this page Nov 30, 2023 · 40 revisions

Here we document any nonconformity in the specification tests.

Arithmetic Functions

DecimalMinValue

Expression:

minimum Decimal

Expected result:

-99999999999999999999.99999999

Actual output:

-79228162514264337593543950335

Rationale:

Per the spec:

Note that if implementations support larger and/or more precise values than the minimum required precision and scale for Decimal, DateTime, and Time values, they will return the minimum representable decimal for the implementation.

Since the SDK uses the C# decimal type to represent the ELM System.Decimal type, we can represent smaller decimals than the minimum required by the specification.

Action:

Test skipped

Recommendation:

Change the expression in the test to be minimum Decimal <= -99999999999999999999.99999999 with an expected output of true

DecimalMaxValue

Expression:

maximum Decimal

Expected result:

99999999999999999999.99999999

Actual output:

79228162514264337593543950335

Rationale:

Per the spec:

Note that if implementations support larger and/or more precise values than the minimum required precision and scale for Decimal, DateTime, and Time values, they will return the minimum representable decimal for the implementation.

Since the SDK uses the C# decimal type to represent the ELM System.Decimal type, we can represent larger decimals than the maximum required by the specification.

Action:

Test skipped

Recommendation:

Change the expression in the test to be maximum Decimal >= 99999999999999999999.99999999 with an expected output of true

Multiply1CMBy2CM

Expression:

1.0 'cm' * 2.0 'cm'

Expected result:

2.0'cm2'

Actual output:

Runtime error

Rationale:

Unit arithmetic is not yet supported. Quantities used in arithmetic expressions must have the default UCUM unit of 1.

Action:

Test skipped

Power2ToNeg2

Expression:

Power(2, -2)

Expected result:

0.25

Actual output:

0

Rationale:

As converted to ELM, the result type of this expression is defined to be System.Integer. Obeying this result type requires that we truncate from 0.25, the mathematically correct result, to 0.

Action:

Test skipped

Recommendation:

The spec discusses behavior for mixed argument types, but does not explicitly state that when Power is used with two Integer arguments that the result type should also be an Integer and decimal portions will be truncated. Given the behavior of the cql-to-elm reference implementation, that behavior is established. This contradicts the expected result of the test. Either the translator has to be updated to match the test, or the test should have an expected outcome of 0. In both cases, the spec should be updated to clarify this.

Round0D5

Expression:

Round(-0.5)

Expected result:

1.0

Actual output:

0

Rationale:

The spec uses the language "traditional round" to describe the rounding method. We use the default rounding strategy which is described in the language as "to nearest." For reference, .NET has devoted significant thought to this here.

This test contradicts the others when using the "to nearest" rounding.

Recommendation:

Clarify the rounding strategy, or fix the expected output of this test.

RoundNeg1D5

See Round0D5

TruncatedDivide10d1ByNeg3D1Quantity

See Multiply1CMBy2CM

Comparison Operators

EquivEqCM1M01

Expression:

1'cm' ~ 0.01'm'

Expected result:

true

Actual output:

false

Rationale:

Quantity comparison of non-same units is not yet supported. Quantities used in comparison expressions must have the same unit.

Action:

Test skipped

QuantityNotEqCM1M01

See EquivEqCM1M01

Date/Time Operators

Duration between tests

Affected tests

  • DateTimeDurationBetweenYear
  • DateTimeDurationBetweenUncertainInterval
  • DateTimeDurationBetweenUncertainInterval2
  • DateTimeDurationBetweenUncertainAdd
  • DateTimeDurationBetweenUncertainSubtract

Example expression (DateTimeDurationBetweenYear):

years between DateTime(2005) and DateTime(2010)

Expected result:

Interval[4,5]

Actual output:

5

Rationale:

Per the spec:

The result of this operation is always an integer; any fractional periods are dropped.

Action:

Tests skipped

Recommendation:

Change the expected output of these tests to be a System.Integer, as indicated by the spec.

Clone this wiki locally