cqframework / cqframework/cql-tests

ValueLiteralsAndSelectors tests exceed Maximum Decimal

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
7
Forks
8
Avg merge
12d 5h
Merged PRs (30d)
2

Description

There are 3 tests in the ValueLiteralsAndSelectors test file that appear to be incorrect because they use values greater than the maximum Decimal value:

https://github.com/cqframework/cql-tests/blob/727219f492c0c84bf7a9c3589b1214e3b4e60667/tests/cql/ValueLiteralsAndSelectors.xml#L342-L356

First the input literal 1000000000000000000000000000.00000000 (10^28) is greater than Decimal max value 99999999999999999999.99999999 (10^28 – 1) / 10^8 .

However the tests indicate version="1.0" and in earlier versions of CQL apparently the max Decimal was higher, so maybe those input literals were valid in that earlier version.

But when I first saw this test I assumed the intent was to show a computation with intermediate values that are above the max value that then returns below the maximum value, for example if it was instead:

10*10000000000000000000.00000000-0.00000001

All of these literals are less than the decimal max value, and the final result is equal to the decimal max value, but the intermediate result of the multiplication is greater than the decimal max value. I think that's also the case with the test as written and the earlier version of CQL - the literals are valid, the intermediate value is larger than the max, and the final subtraction "rescues" the result. In that case, I'm not entirely sure it's incorrect for an implementation to return a value, but I also don't think it should be expected

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/cql/ValueLiteralsAndSelectors.xml lines 342-356 and inspect the three version 1.0 cases against the stated Decimal maximum. Determine whether the literals and intermediate overflow should be valid or expected to fail; done means the tests reflect the agreed CQL behavior, with the expected results made unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.