diff --git a/package.json b/package.json index 9591be2a..12482460 100644 --- a/package.json +++ b/package.json @@ -115,6 +115,7 @@ "build:spec-test-data": "node \"test/spec-tests/generate-cql.js\" && cd \"./test/generator\" && \"./gradlew\" generateSpecTestData && cd ../.. && node \"test/spec-tests/prettify-json.js\"", "build:all": "npm run build && npm run build:browserify && npm run build:test-data && npm run build:spec-test-data", "watch:test-data": "cd \"./test/generator\" && \"./gradlew\" watchTestData && cd ..", + "check-skip-list": "node \"test/spec-tests/check-skip-list.js\"", "test": "cross-env TS_NODE_PROJECT=\"./test/tsconfig.json\" TS_NODE_FILES=true mocha --reporter spec --recursive", "test:nyc": "cross-env TS_NODE_PROJECT=\"./test/tsconfig.json\" TS_NODE_FILES=true nyc --reporter=html npx mocha --reporter spec --recursive", "test:watch": "cross-env TS_NODE_PROJECT=\"./test/tsconfig.json\" TS_NODE_FILES=true mocha --reporter spec --recursive --watch", diff --git a/test/spec-tests/check-skip-list.js b/test/spec-tests/check-skip-list.js new file mode 100644 index 00000000..caa523a6 --- /dev/null +++ b/test/spec-tests/check-skip-list.js @@ -0,0 +1,183 @@ +// Iteratively recheck each skip-list entry by temporarily commenting it out, +// rebuilding, and running tests. Keeps entries that still cause failures, +// removes entries that now pass. Preserves all other lines as-is. + +/* eslint-disable no-console */ + +const fs = require('fs/promises'); +const path = require('path'); +const { spawn } = require('child_process'); + +const SKIP_LIST_PATH = path.join(process.cwd(), 'test', 'spec-tests', 'skip-list.txt'); + +function run(cmd, args, opts = {}) { + return new Promise(resolve => { + const child = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'], ...opts }); + let stdout = ''; + let stderr = ''; + child.stdout.on('data', d => (stdout += d.toString())); + child.stderr.on('data', d => (stderr += d.toString())); + child.on('close', code => resolve({ code, stdout, stderr })); + }); +} + +async function rebuildSpec() { + const r = await run('npm', ['run', 'build:spec-test-data']); + if (r.code !== 0) { + const err = new Error('Spec test data build failed'); + err.detail = r.stderr || r.stdout; + throw err; + } +} + +async function runTests() { + const r = await run('npm', ['test', '--', 'test/spec-tests']); + if (r.code !== 0) { + return { ok: false }; + } + return { ok: true }; +} + +function isComment(line) { + return line.trimStart().startsWith('#'); +} +function isBlank(line) { + return line.trim() === ''; +} +function firstToken(line) { + const m = line.match(/^\s*("[^"]+"|\S+)/); + return m ? m[1] : ''; +} + +async function main() { + // Ensure the script is run from the project root + try { + await fs.stat(SKIP_LIST_PATH); + } catch { + console.error( + 'The check-skip-list script must be run from the project root directory. Use "npm run check-skip-list".' + ); + process.exit(1); + } + + console.log('NOTE: This script incrementally modifies the file: test/spec-tests/skip-list.txt.'); + console.log( + 'If you abort the script before it is completed, check that file to ensure it is correct.\n' + ); + + const originalText = await fs.readFile(SKIP_LIST_PATH, 'utf8'); + const nl = originalText.includes('\r\n') ? '\r\n' : '\n'; + let lines = originalText.split(/\r?\n/); + + // Baseline: ensure tests pass before any changes + console.log('Running baseline tests...'); + const base = await runTests(); + if (!base.ok) { + console.error('Baseline tests failed. Aborting without changes.'); + process.exit(1); + } + console.log('Baseline tests passed.'); + + let totalCandidateTests = 0; + let totalCandidateSuites = 0; + let processed = 0; + let removed = 0; + let kept = 0; + + // First count the total candidates + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (isBlank(line) || isComment(line)) { + continue; + } + const parts = firstToken(line).split('.'); + if (parts.length > 2) { + totalCandidateTests++; + } else { + totalCandidateSuites++; + } + } + console.log( + `\nOriginal skip-list.txt file skips ${totalCandidateSuites} test suites and ${totalCandidateTests} test cases.` + ); + + // Iterate through skip-list entries + for (let i = 0; i < lines.length; ) { + const line = lines[i]; + if (isBlank(line) || isComment(line)) { + i++; + continue; + } + processed++; + + const token = firstToken(line); + const originalLine = line; + const commented = '# ' + originalLine; + + // Comment out current line + lines[i] = commented; + await fs.writeFile(SKIP_LIST_PATH, lines.join(nl), 'utf8'); + + // Rebuild then tests + console.log( + `\n[${processed}/${totalCandidateSuites + totalCandidateTests}] Testing without skipping ${token}` + ); + try { + await rebuildSpec(); + } catch (e) { + console.error('Build failed after commenting out a line. Restoring and continuing.'); + console.error(e.detail || e.message); + lines[i] = originalLine; + await fs.writeFile(SKIP_LIST_PATH, lines.join(nl), 'utf8'); + i++; // move to next line + continue; + } + + const res = await runTests(); + if (!res.ok) { + // Test run failed -> this entry still needs to be skipped; restore line + console.log(`- Still failing. Keeping skip.`); + lines[i] = originalLine; + await fs.writeFile(SKIP_LIST_PATH, lines.join(nl), 'utf8'); + kept++; + i++; // move to next line + } else { + // Test run passed -> remove this line permanently + console.log(`- Now passing. Removing skip.`); + lines.splice(i, 1); + await fs.writeFile(SKIP_LIST_PATH, lines.join(nl), 'utf8'); + removed++; + // do not increment i; next line shifts into this index + } + } + + // Final rebuild + verification run + console.log('\nRebuilding spec test data for final verification...'); + try { + await rebuildSpec(); + } catch (e) { + console.error('Final build failed. Aborting with current state preserved.'); + console.error(e.detail || e.message); + process.exit(1); + } + + console.log('Running final tests...'); + const finalRes = await runTests(); + if (!finalRes.ok) { + console.error( + 'Final tests failed after processing skip-list. Aborting with current state preserved.' + ); + process.exit(1); + } + + console.log('\nDone.'); + console.log(`- Total candidate entries checked: ${processed}`); + console.log(`- Removed (now passing): ${removed}`); + console.log(`- Kept (still failing): ${kept}`); + process.exit(0); +} + +main().catch(err => { + console.error('Unexpected error:', err.message); + process.exit(1); +}); diff --git a/test/spec-tests/cql/CqlDateTimeOperatorsTest.cql b/test/spec-tests/cql/CqlDateTimeOperatorsTest.cql index 7dc1939c..66523644 100644 --- a/test/spec-tests/cql/CqlDateTimeOperatorsTest.cql +++ b/test/spec-tests/cql/CqlDateTimeOperatorsTest.cql @@ -24,11 +24,17 @@ define "Add": Tuple{ output: true }, "DateTimeAddYearInWeeks": Tuple{ - skipped: 'Wrong output: 2018-05-23 + 52 weeks should be 2019-05-22 (both dates should be Wednesdays)' - /* - expression: DateTime(2018, 5, 23) + 52 weeks = DateTime(2019, 5, 23), + expression: DateTime(2018, 5, 23) + 52 weeks = DateTime(2019, 5, 22), output: true - */ }, + }, + "DateTimeLeapDayAddYearInWeeks": Tuple{ + expression: DateTime(2023, 3, 2) + 52 weeks = DateTime(2024, 2, 29), + output: true + }, + "DateTimeLeapYearAddYearInWeeks": Tuple{ + expression: DateTime(2024, 2, 28) + 52 weeks = DateTime(2025, 2, 26), + output: true + }, "DateTimeAdd5Days": Tuple{ expression: DateTime(2005, 5, 10) + 5 days, output: @2005-05-15T @@ -418,11 +424,9 @@ define "DateTimeComponentFrom": Tuple{ output: 955 }, "DateTimeComponentFromTimezone": Tuple{ - skipped: 'Translation Error: Timezone keyword is only valid in 1.3 or lower' - /* expression: timezone from DateTime(2003, 10, 29, 20, 50, 33, 955, 1), invalid: true - */ }, + }, "DateTimeComponentFromTimezone2": Tuple{ expression: timezoneoffset from DateTime(2003, 10, 29, 20, 50, 33, 955, 1), output: 1.00 @@ -696,17 +700,13 @@ define "Uncertainty tests": Tuple{ output: 2 }, "TimeDurationBetweenHourDiffPrecision": Tuple{ - skipped: 'Translation Error: Syntax error at Z' - /* expression: hours between @T06Z and @T07:00:00Z, invalid: true - */ }, + }, "TimeDurationBetweenHourDiffPrecision2": Tuple{ - skipped: 'Wrong output: Duration in hours between T06 and T07:00:00 should be Uncertainty[0, 1]' - /* expression: hours between @T06 and @T07:00:00, output: 1 - */ }, + }, "TimeDurationBetweenMinute": Tuple{ expression: minutes between @T23:20:16.555 and @T23:25:15.555, output: 4 @@ -1179,11 +1179,17 @@ define "Subtract": Tuple{ output: true }, "DateTimeSubtractYearInWeeks": Tuple{ - skipped: 'Wrong output: 2018-05-23 - 52 weeks should be 2019-05-24 (both dates should be Wednesdays)' - /* - expression: DateTime(2018, 5, 23) - 52 weeks = DateTime(2017, 5, 23), + expression: DateTime(2018, 5, 23) - 52 weeks = DateTime(2017, 5, 24), + output: true + }, + "DateTimeLeapDaySubtractYearInWeeks": Tuple{ + expression: DateTime(2024, 2, 29) - 52 weeks = DateTime(2023, 3, 2), output: true - */ }, + }, + "DateTimeLeapYearSubtractYearInWeeks": Tuple{ + expression: DateTime(2024, 3, 1) - 52 weeks = DateTime(2023, 3, 3), + output: true + }, "DateTimeSubtract5Days": Tuple{ expression: DateTime(2005, 5, 10) - 5 days, output: @2005-05-05T @@ -1213,11 +1219,9 @@ define "Subtract": Tuple{ output: @2005-05-10T05:05:05 }, "DateTimeSubtract1YearInSeconds": Tuple{ - skipped: 'Spec says to convert more precise duration to most precise unit in Date. How do you convert seconds to months? 31535999 is 364.999 days, which isn\'t quite 12 months, so we answer 2015-06.' - /* expression: DateTime(2016,5) - 31535999 seconds = DateTime(2015, 5), output: true - */ }, + }, "DateTimeSubtract15HourPrecisionSecond": Tuple{ expression: DateTime(2016, 10, 1, 10, 20, 30) - 15 hours, output: @2016-09-30T19:20:30 diff --git a/test/spec-tests/cql/CqlDateTimeOperatorsTest.json b/test/spec-tests/cql/CqlDateTimeOperatorsTest.json index 50b0104c..5d602b24 100644 --- a/test/spec-tests/cql/CqlDateTimeOperatorsTest.json +++ b/test/spec-tests/cql/CqlDateTimeOperatorsTest.json @@ -443,11 +443,254 @@ "annotation": [], "element": [ { - "name": "skipped", + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Add", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2018", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "23", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2019", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "22", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", "value": { "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}String", - "value": "Wrong output: 2018-05-23 + 52 weeks should be 2019-05-22 (both dates should be Wednesdays)", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", + "annotation": [] + } + } + ] + } + }, + { + "name": "DateTimeLeapDayAddYearInWeeks", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Add", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2023", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2024", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "29", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", + "annotation": [] + } + } + ] + } + }, + { + "name": "DateTimeLeapYearAddYearInWeeks", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Add", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2024", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "28", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2025", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "26", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", "annotation": [] } } @@ -25381,11 +25624,254 @@ "annotation": [], "element": [ { - "name": "skipped", + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Subtract", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2018", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "23", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2017", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "24", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", "value": { "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}String", - "value": "Wrong output: 2018-05-23 - 52 weeks should be 2019-05-24 (both dates should be Wednesdays)", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", + "annotation": [] + } + } + ] + } + }, + { + "name": "DateTimeLeapDaySubtractYearInWeeks", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Subtract", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2024", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "29", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2023", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", + "annotation": [] + } + } + ] + } + }, + { + "name": "DateTimeLeapYearSubtractYearInWeeks", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Equal", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Subtract", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2024", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + } + }, + { + "type": "Quantity", + "value": 52, + "unit": "weeks", + "annotation": [] + } + ] + }, + { + "type": "DateTime", + "annotation": [], + "signature": [], + "year": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2023", + "annotation": [] + }, + "month": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "day": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + } + } + ] + } + }, + { + "name": "output", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Boolean", + "value": "true", "annotation": [] } } diff --git a/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.cql b/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.cql index 9c4a674a..402d7a6b 100644 --- a/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.cql +++ b/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.cql @@ -2,7 +2,7 @@ library CqlErrorsAndMessagingOperatorsTest version '1.4.0' using QUICK version '3.3.0' context Patient -define "Group1": Tuple{ +define "Messaging": Tuple{ "TestMessageInfo": Tuple{ expression: Message(1, true, '100', 'Message', 'Test Message'), output: 1 diff --git a/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.json b/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.json index af1e3706..7327356d 100644 --- a/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.json +++ b/test/spec-tests/cql/CqlErrorsAndMessagingOperatorsTest.json @@ -62,7 +62,7 @@ } }, { - "name": "Group1", + "name": "Messaging", "context": "Patient", "accessLevel": "Public", "annotation": [], diff --git a/test/spec-tests/cql/CqlIntervalOperatorsTest.cql b/test/spec-tests/cql/CqlIntervalOperatorsTest.cql index f6227fcf..0ed5cc58 100644 --- a/test/spec-tests/cql/CqlIntervalOperatorsTest.cql +++ b/test/spec-tests/cql/CqlIntervalOperatorsTest.cql @@ -242,44 +242,142 @@ define "Collapse": Tuple{ } define "Expand": Tuple{ + "ExpandNull": Tuple{ + expression: expand null, + output: null + }, + "ExpandEmptyList": Tuple{ + skipped: 'Wrong answer (should be empty list)' + /* + expression: expand { }, + output: { } + */ }, + "ExpandListWithNull": Tuple{ + skipped: 'Wrong answer (should be empty list due to removing nulls)' + /* + expression: expand { null }, + output: { } + */ }, "ExpandPerDay": Tuple{ expression: expand { Interval[@2018-01-01, @2018-01-04] } per day, output: { Interval[@2018-01-01, @2018-01-01], Interval[@2018-01-02, @2018-01-02], Interval[@2018-01-03, @2018-01-03], Interval[@2018-01-04, @2018-01-04] } }, + "ExpandPerDayIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[@2018-01-01, @2018-01-04] per day, + output: { @2018-01-01, @2018-01-02, @2018-01-03, @2018-01-04 } + */ }, "ExpandPer2Days": Tuple{ expression: expand { Interval[@2018-01-01, @2018-01-04] } per 2 days, output: { Interval[@2018-01-01, @2018-01-02], Interval[@2018-01-03, @2018-01-04] } }, - "ExpandPerHour": Tuple{ - skipped: 'Wrong output: This test is drawn directly from an example in the spec and yet expects a different answer! See: https://cql.hl7.org/09-b-cqlreference.html#expand' + "ExpandPer2DaysIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' /* + expression: expand Interval[@2018-01-01, @2018-01-04] per 2 days, + output: { @2018-01-01, @2018-01-03 } + */ }, + "ExpandPerHour": Tuple{ expression: expand { Interval[@T10:00, @T12:30] } per hour, - output: { Interval[@T10:00, @T11:00), Interval[@T11:00, @T12:00) } + output: { Interval[@T10, @T10], Interval[@T11, @T11], Interval[@T12, @T12] } + }, + "ExpandPerHourIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[@T10:00, @T12:30] per hour, + output: { @T10, @T11, @T12 } */ }, - "ExpandPer1": Tuple{ - skipped: 'Translation Error: Could not resolve call to operator Expand with signature (list>,System.Integer).' + "ExpandPerHourOpen": Tuple{ + expression: expand { Interval[@T10:00, @T12:30) } per hour, + output: { Interval[@T10, @T10], Interval[@T11, @T11], Interval[@T12, @T12] } + }, + "ExpandPerHourOpenIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' /* + expression: expand Interval[@T10:00, @T12:30) per hour, + output: { @T10, @T11, @T12 } + */ }, + "ExpandPer1": Tuple{ expression: expand { Interval[10.0, 12.5] } per 1, output: { Interval[10, 10], Interval[11, 11], Interval[12, 12] } + }, + "ExpandPer1IntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[10.0, 12.5] per 1, + output: { 10, 11, 12 } + */ }, + "ExpandPer1Open": Tuple{ + expression: expand { Interval[10.0, 12.5) } per 1, + output: { Interval[10, 10], Interval[11, 11], Interval[12, 12] } + }, + "ExpandPer1OpenIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[10.0, 12.5) per 1, + output: { 10, 11, 12 } */ }, "ExpandPerMinute": Tuple{ expression: expand { Interval[@T10, @T10] } per minute, output: { } }, + "ExpandPerMinuteIntervalOverload": Tuple{ + expression: expand Interval[@T10, @T10] per minute, + output: { } + }, "ExpandPer0D1": Tuple{ skipped: 'Translation Error: Could not resolve call to operator Expand with signature (list>,System.Decimal).' /* expression: expand { Interval[10, 10] } per 0.1, output: { Interval[10.0, 10.0], Interval[10.1, 10.1], Interval[10.2, 10.2], Interval[10.3, 10.3], Interval[10.4, 10.4], Interval[10.5, 10.5], Interval[10.6, 10.6], Interval[10.7, 10.7], Interval[10.8, 10.8], Interval[10.9, 10.9] } */ }, + "ExpandPer0D1IntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[10, 10] per 0.1, + output: { 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9 } + */ }, "ExpandInterval": Tuple{ expression: expand { Interval[1, 10] }, output: { Interval[1, 1], Interval[2, 2], Interval[3, 3], Interval[4, 4], Interval[5, 5], Interval[6, 6], Interval[7, 7], Interval[8, 8], Interval[9, 9], Interval[10, 10] } }, + "ExpandIntegerIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[1, 10], + output: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } + */ }, + "ExpandIntervalOpen": Tuple{ + expression: expand { Interval[1, 10) }, + output: { Interval[1, 1], Interval[2, 2], Interval[3, 3], Interval[4, 4], Interval[5, 5], Interval[6, 6], Interval[7, 7], Interval[8, 8], Interval[9, 9] } + }, + "ExpandIntegerOpenIntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[1, 10), + output: { 1, 2, 3, 4, 5, 6, 7, 8, 9 } + */ }, "ExpandIntervalPer2": Tuple{ expression: expand { Interval[1, 10] } per 2, output: { Interval[1, 2], Interval[3, 4], Interval[5, 6], Interval[7, 8], Interval[9, 10] } - } + }, + "ExpandIntervalPer2IntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[1, 10] per 2, + output: { 1, 3, 5, 7, 9 } + */ }, + "ExpandIntervalOpenPer2": Tuple{ + expression: expand { Interval[1, 10) } per 2, + output: { Interval[1, 2], Interval[3, 4], Interval[5, 6], Interval[7, 8] } + }, + "ExpandIntervalOpenPer2IntervalOverload": Tuple{ + skipped: 'Wrong answer (single interval overload should return list of points)' + /* + expression: expand Interval[1, 10) per 2, + output: { 1, 3, 5, 7 } + */ } } define "Contains": Tuple{ diff --git a/test/spec-tests/cql/CqlIntervalOperatorsTest.json b/test/spec-tests/cql/CqlIntervalOperatorsTest.json index 3622329b..66415594 100644 --- a/test/spec-tests/cql/CqlIntervalOperatorsTest.json +++ b/test/spec-tests/cql/CqlIntervalOperatorsTest.json @@ -6510,6 +6510,90 @@ "type": "Tuple", "annotation": [], "element": [ + { + "name": "ExpandNull", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "As", + "annotation": [], + "signature": [], + "operand": { + "type": "Null", + "annotation": [] + }, + "asTypeSpecifier": { + "type": "IntervalTypeSpecifier", + "annotation": [], + "pointType": { + "type": "NamedTypeSpecifier", + "name": "{urn:hl7-org:elm-types:r1}Any", + "annotation": [] + } + } + }, + { + "type": "Null", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "Null", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandEmptyList", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (should be empty list)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandListWithNull", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (should be empty list due to removing nulls)", + "annotation": [] + } + } + ] + } + }, { "name": "ExpandPerDay", "value": { @@ -6810,6 +6894,24 @@ ] } }, + { + "name": "ExpandPerDayIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, { "name": "ExpandPer2Days", "value": { @@ -7007,25 +7109,7 @@ } }, { - "name": "ExpandPerHour", - "value": { - "type": "Tuple", - "annotation": [], - "element": [ - { - "name": "skipped", - "value": { - "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}String", - "value": "Wrong output: This test is drawn directly from an example in the spec and yet expects a different answer! See: https://cql.hl7.org/09-b-cqlreference.html#expand", - "annotation": [] - } - } - ] - } - }, - { - "name": "ExpandPer1", + "name": "ExpandPer2DaysIntervalOverload", "value": { "type": "Tuple", "annotation": [], @@ -7035,7 +7119,7 @@ "value": { "type": "Literal", "valueType": "{urn:hl7-org:elm-types:r1}String", - "value": "Translation Error: Could not resolve call to operator Expand with signature (list>,System.Integer).", + "value": "Wrong answer (single interval overload should return list of points)", "annotation": [] } } @@ -7043,7 +7127,7 @@ } }, { - "name": "ExpandPerMinute", + "name": "ExpandPerHour", "value": { "type": "Tuple", "annotation": [], @@ -7073,6 +7157,12 @@ "valueType": "{urn:hl7-org:elm-types:r1}Integer", "value": "10", "annotation": [] + }, + "minute": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "0", + "annotation": [] } }, "high": { @@ -7082,7 +7172,13 @@ "hour": { "type": "Literal", "valueType": "{urn:hl7-org:elm-types:r1}Integer", - "value": "10", + "value": "12", + "annotation": [] + }, + "minute": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "30", "annotation": [] } } @@ -7092,7 +7188,7 @@ { "type": "Quantity", "value": 1, - "unit": "minute", + "unit": "hour", "annotation": [] } ] @@ -7103,14 +7199,99 @@ "value": { "type": "List", "annotation": [], - "element": [] + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + } + } + ] } } ] } }, { - "name": "ExpandPer0D1", + "name": "ExpandPerHourIntervalOverload", "value": { "type": "Tuple", "annotation": [], @@ -7120,7 +7301,7 @@ "value": { "type": "Literal", "valueType": "{urn:hl7-org:elm-types:r1}String", - "value": "Translation Error: Could not resolve call to operator Expand with signature (list>,System.Decimal).", + "value": "Wrong answer (single interval overload should return list of points)", "annotation": [] } } @@ -7128,7 +7309,7 @@ } }, { - "name": "ExpandInterval", + "name": "ExpandPerHourOpen", "value": { "type": "Tuple", "annotation": [], @@ -7147,32 +7328,892 @@ { "type": "Interval", "lowClosed": true, - "highClosed": true, + "highClosed": false, "annotation": [], "low": { - "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}Integer", - "value": "1", - "annotation": [] + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + }, + "minute": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "0", + "annotation": [] + } }, "high": { - "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}Integer", - "value": "10", - "annotation": [] - } - } - ] - }, - { - "type": "Null", - "annotation": [] - } - ] - } - }, - { - "name": "output", + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + }, + "minute": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "30", + "annotation": [] + } + } + } + ] + }, + { + "type": "Quantity", + "value": 1, + "unit": "hour", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + } + } + ] + } + } + ] + } + }, + { + "name": "ExpandPerHourOpenIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandPer1", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Decimal", + "value": "10.0", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Decimal", + "value": "12.5", + "annotation": [] + } + } + ] + }, + { + "type": "Quantity", + "value": 1, + "unit": "1", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + } + ] + } + } + ] + } + }, + { + "name": "ExpandPer1IntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandPer1Open", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": false, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Decimal", + "value": "10.0", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Decimal", + "value": "12.5", + "annotation": [] + } + } + ] + }, + { + "type": "Quantity", + "value": 1, + "unit": "1", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "11", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "12", + "annotation": [] + } + } + ] + } + } + ] + } + }, + { + "name": "ExpandPer1OpenIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandPerMinute", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + } + ] + }, + { + "type": "Quantity", + "value": 1, + "unit": "minute", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [] + } + } + ] + } + }, + { + "name": "ExpandPerMinuteIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + }, + "high": { + "type": "Time", + "annotation": [], + "signature": [], + "hour": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + }, + { + "type": "Quantity", + "value": 1, + "unit": "minute", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [] + } + } + ] + } + }, + { + "name": "ExpandPer0D1", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Translation Error: Could not resolve call to operator Expand with signature (list>,System.Decimal).", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandPer0D1IntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandInterval", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + ] + }, + { + "type": "Null", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "4", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "4", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "6", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "6", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "7", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "7", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "8", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "8", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "9", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "9", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + ] + } + } + ] + } + }, + { + "name": "ExpandIntegerIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandIntervalOpen", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": false, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + ] + }, + { + "type": "Null", + "annotation": [] + } + ] + } + }, + { + "name": "output", "value": { "type": "List", "annotation": [], @@ -7338,24 +8379,6 @@ "value": "9", "annotation": [] } - }, - { - "type": "Interval", - "lowClosed": true, - "highClosed": true, - "annotation": [], - "low": { - "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}Integer", - "value": "10", - "annotation": [] - }, - "high": { - "type": "Literal", - "valueType": "{urn:hl7-org:elm-types:r1}Integer", - "value": "10", - "annotation": [] - } } ] } @@ -7363,6 +8386,24 @@ ] } }, + { + "name": "ExpandIntegerOpenIntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, { "name": "ExpandIntervalPer2", "value": { @@ -7510,6 +8551,172 @@ } ] } + }, + { + "name": "ExpandIntervalPer2IntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } + }, + { + "name": "ExpandIntervalOpenPer2", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "expression", + "value": { + "type": "Expand", + "annotation": [], + "signature": [], + "operand": [ + { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": false, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "10", + "annotation": [] + } + } + ] + }, + { + "type": "Quantity", + "value": 2, + "unit": "1", + "annotation": [] + } + ] + } + }, + { + "name": "output", + "value": { + "type": "List", + "annotation": [], + "element": [ + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "1", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "2", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "3", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "4", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "5", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "6", + "annotation": [] + } + }, + { + "type": "Interval", + "lowClosed": true, + "highClosed": true, + "annotation": [], + "low": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "7", + "annotation": [] + }, + "high": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}Integer", + "value": "8", + "annotation": [] + } + } + ] + } + } + ] + } + }, + { + "name": "ExpandIntervalOpenPer2IntervalOverload", + "value": { + "type": "Tuple", + "annotation": [], + "element": [ + { + "name": "skipped", + "value": { + "type": "Literal", + "valueType": "{urn:hl7-org:elm-types:r1}String", + "value": "Wrong answer (single interval overload should return list of points)", + "annotation": [] + } + } + ] + } } ] } diff --git a/test/spec-tests/cql/CqlTypesTest.cql b/test/spec-tests/cql/CqlTypesTest.cql index 9f34fc2e..d81a9f0e 100644 --- a/test/spec-tests/cql/CqlTypesTest.cql +++ b/test/spec-tests/cql/CqlTypesTest.cql @@ -35,11 +35,9 @@ define "Any": Tuple{ define "DateTime": Tuple{ "DateTimeNull": Tuple{ - skipped: 'Should DateTime(null) really evaluate to null?' - /* expression: DateTime(null), output: null - */ }, + }, "DateTimeUpperBoundExcept": Tuple{ expression: DateTime(10000, 12, 31, 23, 59, 59, 999), invalid: true @@ -80,11 +78,9 @@ define "Quantity": Tuple{ output: 150.2 '[lb_av]' }, "QuantityTest2": Tuple{ - skipped: 'Invalid UCUM unit: According to UCUM spec, custom units only support ASCII characters 33-126, which does not include the space character' - /* expression: 2.5589 '{eskimo kisses}', output: 2.5589 '{eskimo kisses}' - */ }, + }, "QuantityFractionalTooBig": Tuple{ expression: 5.999999999 'g', output: 5.999999999 'g' @@ -104,23 +100,17 @@ define "String": Tuple{ define "Time": Tuple{ "TimeUpperBoundHours": Tuple{ - skipped: 'Translation Error: Invalid time input (T24:59:59.999). Use ISO 8601 time representation (hh:mm:ss.fff).' - /* expression: @T24:59:59.999, invalid: 'semantic' - */ }, + }, "TimeUpperBoundMinutes": Tuple{ - skipped: 'Translation Error: Invalid time input (T23:60:59.999). Use ISO 8601 time representation (hh:mm:ss.fff).' - /* expression: @T23:60:59.999, invalid: 'semantic' - */ }, + }, "TimeUpperBoundSeconds": Tuple{ - skipped: 'Translation Error: Invalid time input (T23:59:60.999). Use ISO 8601 time representation (hh:mm:ss.fff).' - /* expression: @T23:59:60.999, invalid: 'semantic' - */ }, + }, "TimeUpperBoundMillis": Tuple{ expression: @T23:59:59.10000, invalid: 'semantic' diff --git a/test/spec-tests/skip-list.txt b/test/spec-tests/skip-list.txt index 52a052ec..74120b09 100644 --- a/test/spec-tests/skip-list.txt +++ b/test/spec-tests/skip-list.txt @@ -1,16 +1,6 @@ # Invalid CQL (does not translate) - -CqlTypesTest.Time.TimeUpperBoundHours Translation Error: Invalid time input (T24:59:59.999). Use ISO 8601 time representation (hh:mm:ss.fff). -CqlTypesTest.Time.TimeUpperBoundMinutes Translation Error: Invalid time input (T23:60:59.999). Use ISO 8601 time representation (hh:mm:ss.fff). -CqlTypesTest.Time.TimeUpperBoundSeconds Translation Error: Invalid time input (T23:59:60.999). Use ISO 8601 time representation (hh:mm:ss.fff). -"CqlDateTimeOperatorsTest.Uncertainty tests.TimeDurationBetweenHourDiffPrecision" Translation Error: Syntax error at Z -CqlDateTimeOperatorsTest.DateTimeComponentFrom.DateTimeComponentFromTimezone Translation Error: Timezone keyword is only valid in 1.3 or lower -CqlIntervalOperatorsTest.Expand.ExpandPer1 Translation Error: Could not resolve call to operator Expand with signature (list>,System.Integer). CqlIntervalOperatorsTest.Expand.ExpandPer0D1 Translation Error: Could not resolve call to operator Expand with signature (list>,System.Decimal). -# Invalid CQL (translates, but invalid for another reason) -CqlTypesTest.Quantity.QuantityTest2 Invalid UCUM unit: According to UCUM spec, custom units only support ASCII characters 33-126, which does not include the space character - # Invalid Translation (translates, but translates wrong) CqlAggregateTest.AggregateTests.RolledOutIntervals CQL adds an integer to a date ("S + duration in days of X"). Should be "S + Quantity{ value: duration in days of X, unit: 'days' }". Translator translates it, but probably shouldn't. CqlListOperatorsTest.IncludedIn.IncludedInNullRight Converts included in to in, which has different semantics when second argument is null @@ -20,25 +10,31 @@ CqlListOperatorsTest.IncludedIn.IncludedInNullLeft Treats null as point overl CqlListOperatorsTest.Includes.IncludesNullRight Treats null as point overload, translating to "Contains" operator, which has different semantics (and different result) # Incorrect Expected Output -CqlDateTimeOperatorsTest.Add.DateTimeAddYearInWeeks Wrong output: 2018-05-23 + 52 weeks should be 2019-05-22 (both dates should be Wednesdays) -CqlDateTimeOperatorsTest.Subtract.DateTimeSubtractYearInWeeks Wrong output: 2018-05-23 - 52 weeks should be 2019-05-24 (both dates should be Wednesdays) -"CqlDateTimeOperatorsTest.Uncertainty tests.TimeDurationBetweenHourDiffPrecision2" Wrong output: Duration in hours between T06 and T07:00:00 should be Uncertainty[0, 1] -CqlIntervalOperatorsTest.Expand.ExpandPerHour Wrong output: This test is drawn directly from an example in the spec and yet expects a different answer! See: https://cql.hl7.org/09-b-cqlreference.html#expand CqlIntervalOperatorsTest.In.TestInNullBoundaries Wrong output: According to spec, comparison against null closed boundaries should result in true CqlListOperatorsTest.Equal.EqualNullNull Wrong output: According to spec, if either list contains a null, the result is null CqlListOperatorsTest.Sort.simpleSortAsc Wrong output: Queries return distinct lists by default; need to use "all" to retain duplicates -CqlListOperatorsTest.Sort.simpleSortDesc Wrong output: Queries return distinct lists by default; need to use "all" to retain duplicates +CqlListOperatorsTest.Sort.simpleSortDesc Wrong output: Queries return distinct lists by default; need to use "all" to retain duplicates # Potentially Incorrect Expected Output -CqlDateTimeOperatorsTest.Subtract.DateTimeSubtract1YearInSeconds Spec says to convert more precise duration to most precise unit in Date. How do you convert seconds to months? 31535999 is 364.999 days, which isn't quite 12 months, so we answer 2015-06. "CqlStringOperatorsTest.toString tests.DateTimeToString2" Answer does not include timezone offset, but default offset depends on test environment -CqlTypesTest.DateTime.DateTimeNull Should DateTime(null) really evaluate to null? # Incorrect answer - CqlComparisonOperatorsTest.Equal.DateTimeEqNull Wrong answer (true vs null - due to not evaluating DateTime(null) as null) CqlIntervalOperatorsTest.Collapse.TestCollapseNull Wrong answer (Interval(null, null) vs null) CqlIntervalOperatorsTest.Except.NullInterval Wrong answer (Interval(null, null) vs null) +CqlIntervalOperatorsTest.Expand.ExpandEmptyList Wrong answer (should be empty list) +CqlIntervalOperatorsTest.Expand.ExpandIntegerIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandIntegerOpenIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandIntervalOpenPer2IntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandIntervalPer2IntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandListWithNull Wrong answer (should be empty list due to removing nulls) +CqlIntervalOperatorsTest.Expand.ExpandPerDayIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPerHourIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPerHourOpenIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPer0D1IntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPer1IntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPer1OpenIntervalOverload Wrong answer (single interval overload should return list of points) +CqlIntervalOperatorsTest.Expand.ExpandPer2DaysIntervalOverload Wrong answer (single interval overload should return list of points) CqlIntervalOperatorsTest.Intersect.TestIntersectNull Wrong answer (Interval[5, 10] vs Interval[5, null)) CqlTypeOperatorsTest.Convert.StringToDateTime Wrong answer (different offsets) CqlTypeOperatorsTest.ToDateTime.ToDateTime1 Wrong answer (different offsets) @@ -49,7 +45,6 @@ ValueLiteralsAndSelectors.Decimal.DecimalPos10Pow28ToZeroOneStepDecimalMaxValue ValueLiteralsAndSelectors.Decimal.DecimalNeg10Pow28ToZeroOneStepDecimalMinValue Wrong answer (null vs big number) # Incorrect answer due to inability to distinguish integer and decimal for whole numbers (e.g., 1.0) - CqlArithmeticFunctionsTest.Predecessor.PredecessorOf1D Wrong answer (doesn't recognize 1.0 as decimal) CqlArithmeticFunctionsTest.Predecessor.PredecessorOf1QCM Wrong answer (doesn't recognize 1.0 as decimal) CqlArithmeticFunctionsTest.Successor.SuccessorOf1D Wrong answer (doesn't recognize 1.0 as decimal) @@ -62,7 +57,6 @@ ValueLiteralsAndSelectors.Decimal.DecimalPos2Pow31ToInf1 Overflows because it ValueLiteralsAndSelectors.Decimal.DecimalNeg2Pow31ToInf1 Underflows because it thinks it is an integer # Unimplemented - CqlArithmeticFunctionsTest.HighBoundary HighBoundary not implemented CqlArithmeticFunctionsTest.LowBoundary LowBoundary not implemented CqlArithmeticFunctionsTest.Precision.PrecisionDecimal Precision for Decimal not implemented @@ -75,7 +69,6 @@ CqlListOperatorsTest.ProperIn ProperIn not implemented CqlListOperatorsTest.ProperlyIncludedIn.ProperlyIncludedInNulRight ProperIn not implemented # Unimplemented (New in CQL 1.5) - CqlAggregateFunctionsTest.Product.ProductLong Long not implemented CqlAggregateFunctionsTest.Sum.SumTestLong Long not implemented CqlArithmeticFunctionsTest.Abs.AbsLong Long not implemented diff --git a/test/spec-tests/xml/CqlAggregateFunctionsTest.xml b/test/spec-tests/xml/CqlAggregateFunctionsTest.xml index e6a09e9f..9a7d40b3 100644 --- a/test/spec-tests/xml/CqlAggregateFunctionsTest.xml +++ b/test/spec-tests/xml/CqlAggregateFunctionsTest.xml @@ -1,232 +1,232 @@ - - + name="CqlAggregateFunctionsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#aggregate-functions" version="1.5"> + + AllTrue({true,true}) true - + AllTrue({true,false}) false - + AllTrue({false,true}) false - + AllTrue({true,false,true}) false - + AllTrue({false,true,false}) false - + AllTrue({null,true,true}) true - + AllTrue({}) true - + AllTrue(null) true - - + + AnyTrue({true,true}) true - + AnyTrue({false,false}) false - + AnyTrue({true,false,true}) true - + AnyTrue({false,true,false}) true - + AnyTrue({true,false}) true - + AnyTrue({false,true}) true - + AnyTrue({null,true}) true - + AnyTrue({null,false}) false - + AnyTrue({}) false - + AnyTrue(null) false - - + + Avg({ 1.0, 2.0, 3.0, 6.0 }) 3.0 - - + + Product({5L, 4L, 5L}) 100L - - + + Count({ 15, 5, 99, null, 1 }) 4 - + Count({ DateTime(2014), DateTime(2001), DateTime(2010) }) 3 - + Count({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 }) 3 - + Count({}) 0 - - + + Max({ 5, 12, 1, 15, 0, 4, 90, 44 }) 90 - + Max({ 5L, 12L, 1L, 15L, 0L, 4L, 90L, 44L }) 90L - + Max({ 'hi', 'bye', 'zebra' }) 'zebra' - + Max({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6) }) @2012-10-06T - + Max({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 }) @T20:59:59.999 - - + + Median({6.0, 5.0, 4.0, 3.0, 2.0, 1.0}) 3.5 - - + + Min({5, 12, 1, 15, 0, 4, 90, 44}) 0 - + Min({5L, 12L, 1L, 15L, 0L, 4L, 90L, 44L}) 0L - + Min({'hi', 'bye', 'zebra'}) 'bye' - + Min({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6) }) @2012-09-05T - + Min({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 }) @T05:59:59.999 - - + + Mode({ 2, 1, 8, 2, 9, 1, 9, 9 }) 9 - + Mode({ DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 6), DateTime(2012, 9, 5) }) @2012-09-05T - + Mode({ DateTime(2012, 10, 5), DateTime(2012, 10, 5), DateTime(2012, 10, 6), DateTime(2012, 9, 5) }) @2012-10-05T - + Mode({ @T15:59:59.999, @T05:59:59.999, @T20:59:59.999, @T05:59:59.999 }) @T05:59:59.999 - - + + PopulationStdDev({ 1.0, 2.0, 3.0, 4.0, 5.0 }) 1.41421356 - + PopulationStdDev({ null as Quantity, null as Quantity, null as Quantity }) null - - + + PopulationVariance({ 1.0, 2.0, 3.0, 4.0, 5.0 }) 2.0 - + PopulationVariance({ null as Quantity, null as Quantity, null as Quantity }) null - - + + StdDev({ 1.0, 2.0, 3.0, 4.0, 5.0 }) 1.58113883 - + StdDev({ null as Quantity, null as Quantity, null as Quantity }) null - - + + Sum({ 6.0, 2.0, 3.0, 4.0, 5.0 }) 20.0 - + Sum({ 6L, 2L, 3L, 4L, 5L }) 20L - + Sum({1 'ml',2 'ml',3 'ml',4 'ml',5 'ml'}) 15 'ml' - + Sum({ null, 1, null }) 1 - - + + Variance({ 1.0, 2.0, 3.0, 4.0, 5.0 }) 2.5 diff --git a/test/spec-tests/xml/CqlAggregateTest.xml b/test/spec-tests/xml/CqlAggregateTest.xml index ac51c750..98d8d232 100644 --- a/test/spec-tests/xml/CqlAggregateTest.xml +++ b/test/spec-tests/xml/CqlAggregateTest.xml @@ -1,12 +1,12 @@ - - + name="CqlAggregateTest" reference="http://build.fhir.org/ig/HL7/cql/03-developersguide.html#aggregate-queries" version="1.5"> + + ({ 1, 2, 3, 4, 5 }) Num aggregate Result starting 1: Result * Num 120 - + ({ Interval[@2012-01-01, @2012-02-28], @@ -29,7 +29,7 @@ - + ({ 1, 2, 3, 4, 5 }) Num aggregate Result starting 1: Result + Num @@ -37,7 +37,7 @@ 16 - + ({ 1, 2, 3, 4, 5 }) Num aggregate Result: Coalesce(Result, 0) + Num @@ -45,7 +45,7 @@ 15 - + ({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num aggregate all Result: Coalesce(Result, 0) + Num @@ -53,7 +53,7 @@ 24 - + ({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num aggregate distinct Result: Coalesce(Result, 0) + Num @@ -61,14 +61,14 @@ 15 - + from ({1}) X, ({2}) Y, ({3}) Z aggregate Agg: Coalesce(Agg, 0) + X + Y + Z 6 - + from ({1, 2}) X, ({1, 2}) Y, ({1, 2}) Z aggregate Agg starting 0: Agg + X + Y + Z @@ -76,7 +76,7 @@ 36 - + from ({1, 2, 2, 1}) X, ({1, 2, 1, 2}) Y, ({2, 1, 2, 1}) Z aggregate distinct Agg starting 1: Agg + X + Y + Z diff --git a/test/spec-tests/xml/CqlArithmeticFunctionsTest.xml b/test/spec-tests/xml/CqlArithmeticFunctionsTest.xml index f2fe068a..3e580c82 100644 --- a/test/spec-tests/xml/CqlArithmeticFunctionsTest.xml +++ b/test/spec-tests/xml/CqlArithmeticFunctionsTest.xml @@ -1,133 +1,133 @@ - - + name="CqlArithmeticFunctionsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#arithmetic-operators-4" version="1.0"> + + Abs(null as Integer) null - + Abs(0) 0 - + Abs(-1) 1 - + Abs(-1.0) 1.0 - + Abs(0.0) 0.0 - + Abs(-1.0'cm') 1.0'cm' - + Abs(-1L) 1L - - + + 1 + null null - + 1 + 1 2 - + 1L + 2L 3L - + 1.0 + 1.0 2.0 - + 1'g/cm3' + 1'g/cm3' 2.0'g/cm3' - + 1 + 2.0 3.0 - + 1L + 1L 2L - - + + Ceiling(null as Decimal) null - + Ceiling(1.0) 1 - + Ceiling(1.1) 2 - + Ceiling(-0.1) 0 - + Ceiling(-1.0) -1 - + Ceiling(-1.1) -1 - + Ceiling(1) 1 - - + + 1 / null null - + 1 / 0 null - + 0 / 1 0.0 - + 1 / 1 1.0 - + 1L / 1L 1.0 - + 1.0 / 1.0 1.0 - + Round(10 / 3, 8) 3.33333333 - + 1'g/cm3' / 1.0 1.0'g/cm3' - + 1'g/cm3' / 1'g/cm3' 1.0'1' - + 10 / 5.0 2.0 - + 10 / 5 2.0 - + 10.0 'g' / 5 2.0'g' - - + + Floor(null as Decimal) null - + Floor(1) 1 - + Floor(1.0) 1 - + Floor(1.1) 1 - + Floor(-0.1) -1 - + Floor(-1.0) -1 - + Floor(-1.1) -2 - + Floor(2) 2 - - + + Exp(null as Decimal) null - + Exp(0) 1.0 - + Exp(-0) 1.0 - + Round(Exp(1), 8) 2.71828183 - + Round(Exp(1L), 8) 2.71828183 - + Round(Exp(-1), 8) 0.36787944 - + Exp(1000) - + Exp(1000.0) - - + + HighBoundary(1.587, 8) 1.58799999 - + HighBoundary(@2014, 6) @2014-12 - + HighBoundary(@2014-01-01T08, 17) @2014-01-01T08:59:59.999 - + HighBoundary(@T10:30, 9) @T10:30:59.999 - - + + Log(null, null) null - + Log(1, null) null - + Log(1, 1) null - + Log(2, 1) null - + Log(1, 2) 0.0 - + Log(1, 100) 0.0 - + Log(1L, 100L) 0.0 - + Log(16, 2) 4.0 - + Log(0.125, 2) -3.0 - - + + LowBoundary(1.587, 8) 1.58700000 - + LowBoundary(@2014, 6) @2014-01 - + LowBoundary(@2014-01-01T08, 17) @2014-01-01T08:00:00.000 - + LowBoundary(@T10:30, 9) @T10:30:00.000 - - + + Ln(null) null - + Ln(0) - + Ln(-0) - + Ln(1) 0.0 - + Ln(1L) 0.0 - + Ln(-1) null - + Round(Ln(1000), 8) 6.90775528 - + Round(Ln(1000.0), 8) 6.90775528 - - + + minimum Integer -2147483648 - + minimum Long -9223372036854775808L - + minimum Decimal -99999999999999999999.99999999 - + minimum DateTime @0001-01-01T00:00:00.000Z - + minimum Date @0001-01-01 - + minimum Time @T00:00:00.000 - + minimum Boolean - - + + maximum Integer 2147483647 - + maximum Long 9223372036854775807L - + maximum Decimal 99999999999999999999.99999999 - + maximum DateTime @9999-12-31T23:59:59.999Z - + maximum Date @9999-12-31 - + maximum Time @T23:59:59.999 - + maximum Boolean - - + + 1 mod null null - + 0 mod 0 null - + 4 mod 2 0 - + 4L mod 2L 0L - + 4.0 mod 2.0 0.0 - + 10 mod 3 1 - + 10.0 mod 3.0 1.0 - + 10 mod 3.0 1.0 - + 3.5 mod 3 0.5 - + 3.5 'cm' mod 3 'cm' 0.5 'cm' - + 10.0 'g' mod 3.0 'g' 1.0 'g' - + 10.0 'g' mod 0.0 'g' null - - + + 1 * null null - + 1 * 1 1 - + 2L * 3L 6L - + 1.0 * 2.0 2.0 - + 1 * 1L 1L - + 1 * 2.0 2.0 - + 1.0 'cm' * 2.0 'cm' 2.0'cm2' - - + + -(null as Integer) null - + -0 0 - + -(-0) 0 - + -1 -1 - + -1L -1L - + -9223372036854775807L -9223372036854775807L - + -(-1) 1 - + -(-1L) 1L - + -(0.0) 0.0 - + -(-0.0) 0.0 - + -(1.0) -1.0 - + -(-1.0) 1.0 - + -(1'cm') -1.0'cm' - - + + Precision(1.58700) 5 - + Precision(@2014) 4 - + Precision(@2014-01-05T10:30:00.000) 17 - + Precision(@T10:30) 4 - + Precision(@T10:30:00.000) 9 - - + + predecessor of (null as Integer) null - + predecessor of 0 -1 - + predecessor of 1 0 - + predecessor of 1L 0L - + predecessor of 1.0 0.99999999 - + predecessor of 1.01 1.00999999 - + predecessor of 1.0 'cm' 0.99999999'cm' - + predecessor of DateTime(2000,1,1) @1999-12-31T - + predecessor of @T12:00:00.000 @T11:59:59.999 - + predecessor of DateTime(0001, 1, 1, 0, 0, 0, 0) - + predecessor of @T00:00:00.000 - - + + Power(null as Integer, null as Integer) null - + Power(0, 0) 1 - + Power(2, 2) 4 - + Power(-2, 2) 4 - + Power(2, -2) 0.25 - + Power(2L, 2L) 4L - + Power(2.0, 2.0) 4.0 - + Power(-2.0, 2.0) 4.0 - + Power(2.0, -2.0) 0.25 - + Power(2.0, 2) 4.0 - + Power(2, 2.0) 4.0 - + 2^4 16 - + 2L^3L 8L - + 2.0^4.0 16.0 - + Power(2, -2) ~ 0.25 true - - + + Round(null as Decimal) null - + Round(1) 1.0 - + Round(0.5) 1.0 - + Round(0.4) 0.0 - + Round(3.14159, 2) 3.14 - + Round(-0.5) 0.0 - + Round(-0.4) 0.0 - + Round(-0.6) -1.0 - + Round(-1.1) -1.0 - + Round(-1.5) -1.0 - + Round(-1.6) -2.0 - - + + 1 - null null - + 1 - 1 0 - + 1L - 1L 0L - + 1.0 - 2.0 -1.0 - + 1.0 'cm' - 2.0 'cm' -1.0'cm' - + 2 - 1.1 0.9 - - + + successor of (null as Integer) null - + successor of 0 1 - + successor of 1 2 - + successor of 1L 2L - + successor of 1.0 1.00000001 - + successor of 1.01 1.01000001 - + successor of DateTime(2000,1,1) @2000-01-02T - + successor of @T12:00:00.000 @T12:00:00.001 - + successor of DateTime(9999, 12, 31, 23, 59, 59, 999) - + successor of @T23:59:59.999 - - + + Truncate(null as Decimal) null - + Truncate(0) 0 - + Truncate(0.0) 0 - + Truncate(0.1) 0 - + Truncate(1) 1 - + Truncate(1.0) 1 - + Truncate(1.1) 1 - + Truncate(1.9) 1 - + Truncate(-1) -1 - + Truncate(-1.0) -1 - + Truncate(-1.1) -1 - + Truncate(-1.9) -1 - - + + (null as Integer) div (null as Integer) null - + 2 div 1 2 - + 2 div 0 null - + 10 div 3 3 - + 10L div 3L 3L - + 10L div 0L null - + 10.1 div 3.1 3.0 - + 10.1 div 0.0 null - + -2 div -1 2 - + -10 div -3 3 - + -10.1 div -3.1 3.0 - + -2 div 1 -2 - + -10 div 3 -3 - + -10.1 div 3.1 -3.0 - + 2 div -1 -2 - + 10 div -3 -3 - + 10.1 div -3.1 -3.0 - + 10 div 5.0 2.0 - + 10.1 'cm' div -3.1 'cm' -3.0 'cm' - + 10.0 'g' div 5.0 'g' 2.0 'g' - + 4.14 'm' div 2.06 'm' 2.0 'm' - + 10.0 'g' div 0.0 'g' null diff --git a/test/spec-tests/xml/CqlComparisonOperatorsTest.xml b/test/spec-tests/xml/CqlComparisonOperatorsTest.xml index e8407b53..67eb1cee 100644 --- a/test/spec-tests/xml/CqlComparisonOperatorsTest.xml +++ b/test/spec-tests/xml/CqlComparisonOperatorsTest.xml @@ -1,810 +1,810 @@ - - + name="CqlComparisonOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#comparison-operators-4" version="1.0"> + + 4 between 2 and 6 true - - + + true = true true - + true = false false - + false = false true - + false = true false - + null as String = null null - + true = null null - + null = true null - + 1 = 1 true - + 1 = 2 false - + 'a' = 'a' true - + 'a' = 'b' false - + 1.0 = 1.0 true - + 1.0 = 2.0 false - + 1.0 = 1 true - + 1.0 = 2 false - + 1'cm' = 1'cm' true - + 1'cm' = 0.01'm' true - + 2.0'cm' = 2.00'cm' true - + Tuple { Id : 1, Name : 'John' } = Tuple { Id : 1, Name : 'John' } true - + Tuple { Id : 1, Name : 'John' } = Tuple { Id : 2, Name : 'Jane' } false - + Tuple { Id : 1, Name : 'John' } = Tuple { Id : 2, Name : 'John' } false - + Tuple { Id : 1, Name : 'John' } = Tuple { Id : 2, Name : null } false - + Tuple { Id : null, Name : 'John' } = Tuple { Id : 1, Name : 'James' } false - + Tuple { Id : 1, Name : null } = Tuple { Id : 1, Name : null } true - + Tuple { Id : null, Name : 'John' } = Tuple { Id : null, Name : 'John' } true - + Tuple { Id : 1, Name : 'John' } = Tuple { Id : 1, Name : null } null - + Tuple { dateId: 1, Date: DateTime(2012, 10, 5, 0, 0, 0, 0) } = Tuple { dateId: 1, Date: DateTime(2012, 10, 5, 0, 0, 0, 0) } true - + Tuple { dateId: 1, Date: DateTime(2012, 10, 5, 0, 0, 0, 0) } = Tuple { dateId: 1, Date: DateTime(2012, 10, 5, 5, 0, 0, 0) } false - + Tuple { timeId: 55, TheTime: @T05:15:15.541 } = Tuple { timeId: 55, TheTime: @T05:15:15.541 } true - + Tuple { timeId: 55, TheTime: @T05:15:15.541 } = Tuple { timeId: 55, TheTime: @T05:15:15.540 } false - + Today() = Today() true - + Today() = Today() - 1 days false - + DateTime(2014, 1, 5, 5, 0, 0, 0, 0) = DateTime(2014, 1, 5, 5, 0, 0, 0, 0) true - + DateTime(2014, 1, 5, 5, 0, 0, 0, 0) = DateTime(2014, 7, 5, 5, 0, 0, 0, 0) false - + DateTime(null) = DateTime(null) null - + @2014-01-25T14:30:14.559+01:00 = @2014-01-25T14:30:14.559+01:00 true - + @2022-02-22T00:00:00.000-05:00 same day as @2022-02-22T04:59:00.000Z true - + @T10:00:00.000 = @T10:00:00.000 true - + @T10:00:00.000 = @T22:00:00.000 false - - + + 0 > 0 false - + 0 > 1 false - + 0 > -1 true - + 0.0 > 0.0 false - + 0.0 > 1.0 false - + 0.0 > -1.0 true - + 1.0 > 2 false - + 0'cm' > 0'cm' false - + 0'cm' > 1'cm' false - + 0'cm' > -1'cm' true - + 1'm' > 1'cm' true - + 1'm' > 10'cm' true - + 'a' > 'a' false - + 'a' > 'b' false - + 'b' > 'a' true - + 'a' > 'aa' false - + 'aa' > 'a' true - + 'Jack' > 'Jill' false - + DateTime(2012, 2, 12) > DateTime(2012, 2, 10) true - + DateTime(2012, 2, 12) > DateTime(2012, 2, 13) false - + @T10:00:00.001 > @T10:00:00.000 true - + @T10:00:00.000 > @T10:00:00.001 false - + DateTime(2014) > DateTime(2014, 2, 15) null - + DateTime(2015) > DateTime(2014, 2, 15) true - + DateTime(2013) > DateTime(2014, 2, 15) false - - + + 0 >= 0 true - + 0 >= 1 false - + 0 >= -1 true - + 0.0 >= 0.0 true - + 0.0 >= 1.0 false - + 0.0 >= -1.0 true - + 1.0 >= 2 false - + 0'cm' >= 0'cm' true - + 0'cm' >= 1'cm' false - + 0'cm' >= -1'cm' true - + 1'm' >= 1'cm' true - + 1'm' >= 10'cm' true - + 'a' >= 'a' true - + 'a' >= 'b' false - + 'b' >= 'a' true - + 'a' >= 'aa' false - + 'aa' >= 'a' true - + 'Jack' >= 'Jill' false - + DateTime(2012, 2, 12, 0, 0, 0, 0) >= DateTime(2012, 2, 10, 0, 0, 0, 0) true - + DateTime(2012, 2, 12, 0, 0, 0, 0) >= DateTime(2012, 2, 12, 0, 0, 0, 0) true - + DateTime(2012, 2, 12, 0, 0, 0, 0) >= DateTime(2012, 2, 13, 0, 0, 0, 0) false - + @T10:00:00.001 >= @T10:00:00.000 true - + @T10:00:00.000 >= @T10:00:00.000 true - + @T10:00:00.000 >= @T10:00:00.001 false - + DateTime(2014) >= DateTime(2014, 2, 15) null - + DateTime(2015) >= DateTime(2014, 2, 15) true - + DateTime(2013) >= DateTime(2014, 2, 15) false - - + + 0 < 0 false - + 0 < 1 true - + 0 < -1 false - + 0.0 < 0.0 false - + 0.0 < 1.0 true - + 0.0 < -1.0 false - + 1.0 < 2 true - + 0'cm' < 0'cm' false - + 0'cm' < 1'cm' true - + 0'cm' < -1'cm' false - + 1'm' < 1'cm' false - + 1'm' < 10'cm' false - + 'a' < 'a' false - + 'a' < 'b' true - + 'b' < 'a' false - + 'a' < 'aa' true - + 'aa' < 'a' false - + 'Jack' < 'Jill' true - + DateTime(2012, 2, 9) < DateTime(2012, 2, 10) true - + DateTime(2012, 2, 14) < DateTime(2012, 2, 13) false - + @T10:00:00.001 < @T10:00:00.002 true - + @T10:10:00.000 < @T10:00:00.001 false - + DateTime(2014) < DateTime(2014, 2, 15) null - + DateTime(2013) < DateTime(2014, 2, 15) true - + DateTime(2015) < DateTime(2014, 2, 15) false - - + + 0 <= 0 true - + 0 <= 1 true - + 0 <= -1 false - + 0.0 <= 0.0 true - + 0.0 <= 1.0 true - + 0.0 <= -1.0 false - + 1.0 <= 2 true - + 0'cm' <= 0'cm' true - + 0'cm' <= 1'cm' true - + 0'cm' <= -1'cm' false - + 1'm' <= 1'cm' false - + 1'm' <= 10'cm' false - + 'a' <= 'a' true - + 'a' <= 'b' true - + 'b' <= 'a' false - + 'a' <= 'aa' true - + 'aa' <= 'a' false - + 'Jack' <= 'Jill' true - + DateTime(2012, 2, 9, 0, 0, 0, 0) <= DateTime(2012, 2, 10, 0, 0, 0, 0) true - + DateTime(2012, 2, 12, 0, 0, 0, 0) <= DateTime(2012, 2, 12, 0, 0, 0, 0) true - + DateTime(2012, 2, 12, 1, 0, 0, 0) <= DateTime(2012, 2, 12, 0, 0, 0, 0) false - + @T10:00:00.001 <= @T10:00:00.002 true - + @T10:00:00.000 <= @T10:00:00.000 true - + @T10:00:00.002 <= @T10:00:00.001 false - + DateTime(2014) <= DateTime(2014, 2, 15) null - + DateTime(2013) <= DateTime(2014, 2, 15) true - + DateTime(2015) <= DateTime(2014, 2, 15) false - - + + true ~ true true - + true ~ false false - + false ~ false true - + false ~ true false - + null as String ~ null true - + true ~ null false - + null ~ true false - + 1 ~ 1 true - + 1 ~ 2 false - + 'a' ~ 'a' true - + 'a' ~ 'b' false - + 1.0 ~ 1.0 true - + 1.0 ~ 2.0 false - + 1.0 ~ 1 true - + 1.0 ~ 2 false - + 1'cm' ~ 1'cm' true - + 1'cm' ~ 0.01'm' true - + Tuple { Id : 1, Name : 'John' } ~ Tuple { Id : 1, Name : 'John' } true - + Tuple { Id : 1, Name : 'John', Position: null } ~ Tuple { Id : 1, Name : 'John', Position: null } true - + Tuple { Id : 1, Name : 'John' } ~ Tuple { Id : 2, Name : 'Jane' } false - + Tuple { Id : 1, Name : 'John' } ~ Tuple { Id : 2, Name : 'John' } false - + Today() ~ Today() true - + Today() ~ Today() - 1 days false - + @T10:00:00.000 ~ @T10:00:00.000 true - + @T10:00:00.000 ~ @T22:00:00.000 false - - + + true != true false - + true != false true - + false != false false - + false != true true - + null as String != null null - + true != null null - + null != true null - + 1 != 1 false - + 1 != 2 true - + 'a' != 'a' false - + 'a' != 'b' true - + 1.0 != 1.0 false - + 1.0 != 2.0 true - + 1.0 != 1 false - + 1.0 != 2 true - + 1'cm' != 1'cm' false - + 1'cm' != 0.01'm' false - + Tuple{ Id : 1, Name : 'John' } != Tuple{ Id : 1, Name : 'John' } false - + Tuple{ Id : 1, Name : 'John' } != Tuple{ Id : 2, Name : 'Jane' } true - + Tuple{ Id : 1, Name : 'John' } != Tuple{ Id : 2, Name : 'John' } true - + Tuple{ Id : 1, Name : 'John' } != Tuple{ Id : 2, Name : null } true - + Tuple{ Id : null, Name : 'John' } != Tuple{ Id : 1, Name : 'Joe' } true - + Tuple{ Id : 1, Name : null } != Tuple{ Id : 1, Name : null } false - + Tuple{ Id : null, Name : 'John' } != Tuple{ Id : null, Name : 'John' } false - + Tuple{ Id : 1, Name : 'John' } != Tuple{ Id : 1, Name : null } null - + Today() != Today() false - + Today() != Today() - 1 days true - + @T10:00:00.000 != @T10:00:00.000 false - + @T10:00:00.000 != @T22:00:00.000 true diff --git a/test/spec-tests/xml/CqlConditionalOperatorsTest.xml b/test/spec-tests/xml/CqlConditionalOperatorsTest.xml index 1da5d0ea..ab3203be 100644 --- a/test/spec-tests/xml/CqlConditionalOperatorsTest.xml +++ b/test/spec-tests/xml/CqlConditionalOperatorsTest.xml @@ -1,22 +1,22 @@ - - + name="CqlConditionalOperatorsTest" reference="https://cql.hl7.org/03-developersguide.html#conditional-expressions" version="1.0"> + + if 10 > 5 then 5 else 10 5 - + if 10 = 5 then 10 + 5 else 10 - 5 5 - + if 10 = null then 5 else 10 10 - - + + case when 10 > 5 then 5 @@ -26,7 +26,7 @@ 5 - + case when 5 > 10 then 5 + 10 @@ -36,7 +36,7 @@ 5 - + case when null ~ 10 then null + 10 @@ -47,8 +47,8 @@ 15 - - + + case 5 when 5 then 12 @@ -58,7 +58,7 @@ 12 - + case 10 when 5 then 12 @@ -68,7 +68,7 @@ 15 - + case 10 + 5 when 5 then 12 diff --git a/test/spec-tests/xml/CqlDateTimeOperatorsTest.xml b/test/spec-tests/xml/CqlDateTimeOperatorsTest.xml index 67ce07d6..e2008411 100644 --- a/test/spec-tests/xml/CqlDateTimeOperatorsTest.xml +++ b/test/spec-tests/xml/CqlDateTimeOperatorsTest.xml @@ -1,589 +1,609 @@ - - + name="CqlDateTimeOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#datetime-operators-2" version="1.4"> + + DateTime(2005, 10, 10) + 5 years @2010-10-10T - + DateTime(2005, 10, 10) + 8000 years - + DateTime(2005, 5, 10) + 5 months @2005-10-10T - + DateTime(2005, 5, 10) + 10 months @2006-03-10T - + DateTime(2018, 5, 2) + 3 weeks = DateTime(2018, 5, 23) true + + + - - DateTime(2018, 5, 23) + 52 weeks = DateTime(2019, 5, 23) + + DateTime(2018, 5, 23) + 52 weeks = DateTime(2019, 5, 22) true + + + - + + DateTime(2023, 3, 2) + 52 weeks = DateTime(2024, 2, 29) + true + + + + + + DateTime(2024, 2, 28) + 52 weeks = DateTime(2025, 2, 26) + true + + + + + DateTime(2005, 5, 10) + 5 days @2005-05-15T - + DateTime(2016, 6, 10) + 21 days @2016-07-01T - + DateTime(2005, 5, 10, 5) + 5 hours @2005-05-10T10 - + DateTime(2005, 5, 10, 5, 20, 30) + 5 hours @2005-05-10T10:20:30 - + DateTime(2005, 5, 10) + 5 hours = DateTime(2005, 5, 10) true - + DateTime(2005, 5, 10) + 25 hours = DateTime(2005, 5, 11) true - + Date(2014) + 24 months @2016 - + Date(2014) + 25 months @2016 - + Date(2014,6) + 33 days @2014-07 - + Date(2014,6) + 1 year @2015-06 - + DateTime(2016, 6, 10, 5) + 19 hours @2016-06-11T00 - + DateTime(2005, 5, 10, 5, 5) + 5 minutes @2005-05-10T05:10 - + DateTime(2016, 6, 10, 5, 5) + 55 minutes @2016-06-10T06:00 - + DateTime(2005, 5, 10, 5, 5, 5) + 5 seconds @2005-05-10T05:05:10 - + DateTime(2016, 6, 10, 5, 5, 5) + 55 seconds @2016-06-10T05:06:00 - + DateTime(2005, 5, 10, 5, 5, 5, 5) + 5 milliseconds @2005-05-10T05:05:05.010 - + DateTime(2016, 6, 10, 5, 5, 5, 5) + 995 milliseconds @2016-06-10T05:05:06.000 - + DateTime(2012, 2, 29) + 1 year @2013-02-28T - + DateTime(2014) + 24 months @2016T - + DateTime(2014) + 730 days @2016T - + DateTime(2014) + 735 days @2016T - + @T15:59:59.999 + 5 hours @T20:59:59.999 - + @T15:59:59.999 + 1 minute @T16:00:59.999 - + @T15:59:59.999 + 1 seconds @T16:00:00.999 - + @T15:59:59.999 + 1 milliseconds @T16:00:00.000 - + @T15:59:59.999 + 5 hours + 1 minutes @T21:00:59.999 - + @T15:59:59.999 + 300 minutes @T20:59:59.999 - - + + DateTime(2005, 10, 10) after year of DateTime(2004, 10, 10) true - + DateTime(2004, 11, 10) after year of DateTime(2004, 10, 10) false - + DateTime(2004, 12, 10) after month of DateTime(2004, 11, 10) true - + DateTime(2004, 9, 10) after month of DateTime(2004, 10, 10) false - + DateTime(2004, 12, 11) after day of DateTime(2004, 10, 10) true - + DateTime(2004, 12, 09) after day of DateTime(2003, 10, 10) true - + DateTime(2004, 10, 9) after day of DateTime(2004, 10, 10) false - + DateTime(2004, 10, 10, 10) after hour of DateTime(2004, 10, 10, 5) true - + DateTime(2004, 10, 10, 20) after hour of DateTime(2004, 10, 10, 21) false - + DateTime(2004, 10, 10, 20, 30) after minute of DateTime(2004, 10, 10, 20, 29) true - + DateTime(2004, 10, 10, 20, 30) after minute of DateTime(2004, 10, 10, 20, 31) false - + DateTime(2004, 10, 10, 20, 30, 15) after second of DateTime(2004, 10, 10, 20, 30, 14) true - + DateTime(2004, 10, 10, 20, 30, 15) after second of DateTime(2004, 10, 10, 20, 30, 16) false - + DateTime(2004, 10, 10, 20, 30, 15, 512) after millisecond of DateTime(2004, 10, 10, 20, 30, 15, 510) true - + DateTime(2004, 10, 10, 20, 30, 15, 512) after millisecond of DateTime(2004, 10, 10, 20, 30, 15, 513) false - + DateTime(2005, 10, 10) after day of DateTime(2005, 9) true - + @2012-03-10T10:20:00.999+07:00 after hour of @2012-03-10T08:20:00.999+06:00 true - + @2012-03-10T10:20:00.999+07:00 after hour of @2012-03-10T10:20:00.999+06:00 false - + @T15:59:59.999 after hour of @T14:59:59.999 true - + @T15:59:59.999 after hour of @T16:59:59.999 false - + @T15:59:59.999 after minute of @T15:58:59.999 true - + @T15:58:59.999 after minute of @T15:59:59.999 false - + @T15:59:59.999 after second of @T15:59:58.999 true - + @T15:59:58.999 after second of @T15:59:59.999 false - + @T15:59:59.999 after millisecond of @T15:59:59.998 true - + @T15:59:59.998 after millisecond of @T15:59:59.999 false - + Time(12, 30) after hour of Time(11, 55) true - - + + DateTime(2003) before year of DateTime(2004, 10, 10) true - + DateTime(2004, 11, 10) before year of DateTime(2003, 10, 10) false - + DateTime(2004, 10, 10) before month of DateTime(2004, 11, 10) true - + DateTime(2004, 11, 10) before month of DateTime(2004, 10, 10) false - + DateTime(2004, 10, 1) before day of DateTime(2004, 10, 10) true - + DateTime(2003, 10, 11) before day of DateTime(2004, 10, 10) true - + DateTime(2004, 10, 11) before day of DateTime(2004, 10, 10) false - + DateTime(2004, 10, 10, 1) before hour of DateTime(2004, 10, 10, 5) true - + DateTime(2004, 10, 10, 23) before hour of DateTime(2004, 10, 10, 21) false - + DateTime(2004, 10, 10, 20, 28) before minute of DateTime(2004, 10, 10, 20, 29) true - + DateTime(2004, 10, 10, 20, 35) before minute of DateTime(2004, 10, 10, 20, 31) false - + DateTime(2004, 10, 10, 20, 30, 12) before second of DateTime(2004, 10, 10, 20, 30, 14) true - + DateTime(2004, 10, 10, 20, 30, 55) before second of DateTime(2004, 10, 10, 20, 30, 16) false - + DateTime(2004, 10, 10, 20, 30, 15, 508) before millisecond of DateTime(2004, 10, 10, 20, 30, 15, 510) true - + DateTime(2004, 10, 10, 20, 30, 15, 599) before millisecond of DateTime(2004, 10, 10, 20, 30, 15, 513) false - + @2012-03-10T10:20:00.999+07:00 before hour of @2012-03-10T10:20:00.999+06:00 true - + @2012-03-10T10:20:00.999+07:00 before hour of @2012-03-10T09:20:00.999+06:00 false - + @T13:59:59.999 before hour of @T14:59:59.999 true - + @T16:59:59.999 before hour of @T15:59:59.999 false - + @T15:57:59.999 before minute of @T15:58:59.999 true - + @T15:59:59.999 before minute of @T15:59:59.999 false - + @T15:59:57.999 before second of @T15:59:58.999 true - + @T15:59:56.999 before second of @T15:59:55.999 false - + @T15:59:59.997 before millisecond of @T15:59:59.998 true - + @T15:59:59.998 before millisecond of @T15:59:59.997 false - - + + DateTime(2003) @2003T - + DateTime(2003, 10) @2003-10T - + DateTime(2003, 10, 29) @2003-10-29T - + DateTime(2003, 10, 29, 20) @2003-10-29T20 - + DateTime(2003, 10, 29, 20, 50) @2003-10-29T20:50 - + DateTime(2003, 10, 29, 20, 50, 33) @2003-10-29T20:50:33 - + DateTime(2003, 10, 29, 20, 50, 33, 955) @2003-10-29T20:50:33.955 - - + + year from DateTime(2003, 10, 29, 20, 50, 33, 955) 2003 - + month from DateTime(2003, 10, 29, 20, 50, 33, 955) 10 - + month from DateTime(2003, 01, 29, 20, 50, 33, 955) 1 - + day from DateTime(2003, 10, 29, 20, 50, 33, 955) 29 - + hour from DateTime(2003, 10, 29, 20, 50, 33, 955) 20 - + minute from DateTime(2003, 10, 29, 20, 50, 33, 955) 50 - + second from DateTime(2003, 10, 29, 20, 50, 33, 955) 33 - + millisecond from DateTime(2003, 10, 29, 20, 50, 33, 955) 955 - + timezone from DateTime(2003, 10, 29, 20, 50, 33, 955, 1) - + timezoneoffset from DateTime(2003, 10, 29, 20, 50, 33, 955, 1) 1.00 - + date from DateTime(2003, 10, 29, 20, 50, 33, 955, 1) @2003-10-29 - + hour from @T23:20:15.555 23 - + minute from @T23:20:15.555 20 - + second from @T23:20:15.555 15 - + millisecond from @T23:20:15.555 555 - - + + difference in years between DateTime(2000) and DateTime(2005, 12) 5 - + difference in months between DateTime(2000, 2) and DateTime(2000, 10) 8 - + difference in days between DateTime(2000, 10, 15, 10, 30) and DateTime(2000, 10, 25, 10, 0) 10 - + difference in hours between DateTime(2000, 4, 1, 12) and DateTime(2000, 4, 1, 20) 8 - + difference in minutes between DateTime(2005, 12, 10, 5, 16) and DateTime(2005, 12, 10, 5, 25) 9 - + difference in seconds between DateTime(2000, 10, 10, 10, 5, 45) and DateTime(2000, 10, 10, 10, 5, 50) 5 - + difference in milliseconds between DateTime(2000, 10, 10, 10, 5, 45, 500, -6.0) and DateTime(2000, 10, 10, 10, 5, 45, 900, -7.0) 3600400 - + difference in weeks between DateTime(2000, 10, 15) and DateTime(2000, 10, 28) 1 - + difference in weeks between DateTime(2000, 10, 15) and DateTime(2000, 10, 29) 2 - + difference in weeks between @2012-03-10T22:05:09 and @2012-03-24T07:19:33 2 - + difference in years between DateTime(2016) and DateTime(1998) -18 - + difference in months between DateTime(2005) and DateTime(2006, 7) > 5 true - + difference in hours between @T20 and @T23:25:15.555 3 - + difference in minutes between @T20:20:15.555 and @T20:25:15.555 5 - + difference in seconds between @T20:20:15.555 and @T20:20:20.555 5 - + difference in milliseconds between @T20:20:15.555 and @T20:20:15.550 -5 - - + + @2017-03-12T01:00:00-07:00 @2017-03-12T01:00:00-07:00 - + DateTime(2017, 3, 12, 1, 0, 0, 0, -7.0) @2017-03-12T01:00:00.000-07:00 - + @2017-03-12T03:00:00-06:00 @2017-03-12T03:00:00-06:00 - + DateTime(2017, 3, 12, 3, 0, 0, 0, -6.0) @2017-03-12T03:00:00.000-06:00 - + @2017-11-05T01:30:00-06:00 @2017-11-05T01:30:00-06:00 - + DateTime(2017, 11, 5, 1, 30, 0, 0, -6.0) @2017-11-05T01:30:00.000-06:00 - + @2017-11-05T01:15:00-07:00 @2017-11-05T01:15:00-07:00 - + DateTime(2017, 11, 5, 1, 15, 0, 0, -7.0) @2017-11-05T01:15:00.000-07:00 - + @2017-03-12T00:00:00-07:00 @2017-03-12T00:00:00-07:00 - + DateTime(2017, 3, 12, 0, 0, 0, 0, -7.0) @2017-03-12T00:00:00.000-07:00 - + @2017-03-13T00:00:00-06:00 @2017-03-13T00:00:00-06:00 - + DateTime(2017, 3, 13, 0, 0, 0, 0, -6.0) @2017-03-13T00:00:00.000-06:00 - + difference in hours between @2017-03-12T01:00:00-07:00 and @2017-03-12T03:00:00-06:00 1 - + difference in minutes between @2017-11-05T01:30:00-06:00 and @2017-11-05T01:15:00-07:00 45 - + difference in days between @2017-03-12T00:00:00-07:00 and @2017-03-13T00:00:00-06:00 1 - + difference in hours between DateTime(2017, 3, 12, 1, 0, 0, 0, -7.0) and DateTime(2017, 3, 12, 3, 0, 0, 0, -6.0) 1 - + difference in minutes between DateTime(2017, 11, 5, 1, 30, 0, 0, -6.0) and DateTime(2017, 11, 5, 1, 15, 0, 0, -7.0) 45 - + difference in days between DateTime(2017, 3, 12, 0, 0, 0, 0, -7.0) and DateTime(2017, 3, 13, 0, 0, 0, 0, -6.0) 1 - - + + years between DateTime(2005) and DateTime(2010) Interval[ 4, 5 ] - + years between DateTime(2005, 5) and DateTime(2010, 4) 4 - + months between @2014-01-31 and @2014-02-01 0 - + days between DateTime(2010, 10, 12, 12, 5) and DateTime(2008, 8, 15, 8, 8) -788 - - + + days between DateTime(2014, 1, 15) and DateTime(2014, 2) Interval[ 16, 44 ] - + months between DateTime(2005) and DateTime(2006, 5) Interval[ 4, 16 ] - + (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) + (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) Interval[ 32, 88 ] @@ -630,7 +650,7 @@ selecting the same value, conceptually an implementation internal; currently Equivalent() results in null from comparing with an Interval. --> - + (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) - (months between DateTime(2005) and DateTime(2006, 5)) Interval[ 0, 40 ] @@ -639,7 +659,7 @@ selecting the same value, conceptually an implementation internal; currently Equivalent() results in null from comparing with an Interval. --> - + (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) * (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) Interval[ 256, 1936 ] @@ -648,114 +668,114 @@ selecting the same value, conceptually an implementation internal; currently Equivalent() results in null from comparing with an Interval. --> - + (days between DateTime(2014, 1, 15) and DateTime(2014, 2)) div (months between DateTime(2005) and DateTime(2006, 5)) - + months between DateTime(2005) and DateTime(2006, 7) > 5 true - + months between DateTime(2005) and DateTime(2006, 2) > 5 null - + months between DateTime(2005) and DateTime(2006, 7) > 25 false - + months between DateTime(2005) and DateTime(2006, 7) < 24 true - + months between DateTime(2005) and DateTime(2006, 7) = 24 false - + months between DateTime(2005) and DateTime(2006, 7) >= 5 true - + months between DateTime(2005) and DateTime(2006, 7) <= 24 true - + @2012-03-10T10:20:00 @2012-03-10T10:20:00 - + @2013-03-10T09:20:00 @2013-03-10T09:20:00 - + years between (date from @2012-03-10T10:20:00) and (date from @2013-03-10T09:20:00) 1 - + weeks between @2012-03-10T22:05:09 and @2012-03-20T07:19:33 1 - + weeks between @2012-03-10T22:05:09 and @2012-03-24T07:19:33 1 - + weeks between @2012-03-10T06:05:09 and @2012-03-24T07:19:33 2 - + hours between @T20:26:15.555 and @T23:25:15.555 2 - + hours between @T06Z and @T07:00:00Z - + hours between @T06 and @T07:00:00 1 - + minutes between @T23:20:16.555 and @T23:25:15.555 4 - + seconds between @T23:25:10.556 and @T23:25:15.555 4 - + milliseconds between @T23:25:25.555 and @T23:25:25.560 5 - + hours between @2017-03-12T01:00:00-07:00 and @2017-03-12T03:00:00-06:00 1 - + minutes between @2017-11-05T01:30:00-06:00 and @2017-11-05T01:15:00-07:00 45 - + days between @2017-03-12T00:00:00-07:00 and @2017-03-13T00:00:00-06:00 0 - + hours between DateTime(2017, 3, 12, 1, 0, 0, 0, -7.0) and DateTime(2017, 3, 12, 3, 0, 0, 0, -6.0) 1 - + minutes between DateTime(2017, 11, 5, 1, 30, 0, 0, -6.0) and DateTime(2017, 11, 5, 1, 15, 0, 0, -7.0) 45 - + days between DateTime(2017, 3, 12, 0, 0, 0, 0, -7.0) and DateTime(2017, 3, 13, 0, 0, 0, 0, -6.0) 0 - - + + Now() = Now() true @@ -764,560 +784,580 @@ Now() TODO: Replace this with Java-native test as with original. --> - + DateTime(2014) same year as DateTime(2014) true - + DateTime(2013) same year as DateTime(2014) false - + DateTime(2014, 12) same month as DateTime(2014, 12) true - + DateTime(2014, 12) same month as DateTime(2014, 10) false - + DateTime(2014, 12, 10) same day as DateTime(2014, 12, 10) true - + DateTime(2014, 10, 10) same day as DateTime(2014, 10, 11) false - + DateTime(2014, 12, 10, 20) same hour as DateTime(2014, 12, 10, 20) true - + DateTime(2014, 10, 10, 20) same hour as DateTime(2014, 10, 10, 21) false - + DateTime(2014, 12, 10, 20, 55) same minute as DateTime(2014, 12, 10, 20, 55) true - + DateTime(2014, 10, 10, 20, 55) same minute as DateTime(2014, 10, 10, 21, 56) false - + DateTime(2014, 12, 10, 20, 55, 45) same second as DateTime(2014, 12, 10, 20, 55, 45) true - + DateTime(2014, 10, 10, 20, 55, 45) same second as DateTime(2014, 10, 10, 21, 55, 44) false - + DateTime(2014, 12, 10, 20, 55, 45, 500) same millisecond as DateTime(2014, 12, 10, 20, 55, 45, 500) true - + DateTime(2014, 10, 10, 20, 55, 45, 500) same millisecond as DateTime(2014, 10, 10, 21, 55, 45, 501) false - + DateTime(2014, 10) same day as DateTime(2014, 10, 12) null - + @2012-03-10T10:20:00.999+07:00 same hour as @2012-03-10T09:20:00.999+06:00 true - + @2012-03-10T10:20:00.999+07:00 same hour as @2012-03-10T10:20:00.999+06:00 false - + @T23:25:25.555 same hour as @T23:55:25.900 true - + @T22:25:25.555 same hour as @T23:25:25.555 false - + @T23:55:22.555 same minute as @T23:55:25.900 true - + @T23:26:25.555 same minute as @T23:25:25.555 false - + @T23:55:25.555 same second as @T23:55:25.900 true - + @T23:25:35.555 same second as @T23:25:25.555 false - + @T23:55:25.555 same millisecond as @T23:55:25.555 true - + @T23:25:25.555 same millisecond as @T23:25:25.554 false - - + + DateTime(2014) same year or after DateTime(2014) true - + DateTime(2016) same year or after DateTime(2014) true - + DateTime(2013) same year or after DateTime(2014) false - + DateTime(2014, 12) same month or after DateTime(2014, 12) true - + DateTime(2014, 10) same month or after DateTime(2014, 9) true - + DateTime(2014, 10) same month or after DateTime(2014, 11) false - + DateTime(2014, 12, 20) same day or after DateTime(2014, 12, 20) true - + DateTime(2014, 10, 25) same day or after DateTime(2014, 10, 20) true - + DateTime(2014, 10, 20) same day or after DateTime(2014, 10, 25) false - + DateTime(2014, 12, 20, 12) same hour or after DateTime(2014, 12, 20, 12) true - + DateTime(2014, 10, 25, 12) same hour or after DateTime(2014, 10, 25, 10) true - + DateTime(2014, 10, 25, 12) same hour or after DateTime(2014, 10, 25, 15) false - + DateTime(2014, 12, 20, 12, 30) same minute or after DateTime(2014, 12, 20, 12, 30) true - + DateTime(2014, 10, 25, 10, 30) same minute or after DateTime(2014, 10, 25, 10, 25) true - + DateTime(2014, 10, 25, 15, 30) same minute or after DateTime(2014, 10, 25, 15, 45) false - + DateTime(2014, 12, 20, 12, 30, 15) same second or after DateTime(2014, 12, 20, 12, 30, 15) true - + DateTime(2014, 10, 25, 10, 25, 25) same second or after DateTime(2014, 10, 25, 10, 25, 20) true - + DateTime(2014, 10, 25, 15, 45, 20) same second or after DateTime(2014, 10, 25, 15, 45, 21) false - + DateTime(2014, 12, 20, 12, 30, 15, 250) same millisecond or after DateTime(2014, 12, 20, 12, 30, 15, 250) true - + DateTime(2014, 10, 25, 10, 25, 20, 500) same millisecond or after DateTime(2014, 10, 25, 10, 25, 20, 499) true - + DateTime(2014, 10, 25, 15, 45, 20, 500) same millisecond or after DateTime(2014, 10, 25, 15, 45, 20, 501) false - + DateTime(2014, 12, 20) same day or after DateTime(2014, 12) null - + @2012-03-10T10:20:00.999+07:00 same hour or after @2012-03-10T09:20:00.999+06:00 true - + @2012-03-10T10:20:00.999+07:00 same hour or after @2012-03-10T10:20:00.999+06:00 false - + @T23:25:25.555 same hour or after @T23:55:25.900 true - + @T23:25:25.555 same hour or after @T22:55:25.900 true - + @T22:25:25.555 same hour or after @T23:55:25.900 false - + @T23:25:25.555 same minute or after @T23:25:25.900 true - + @T23:25:25.555 same minute or after @T22:15:25.900 true - + @T23:25:25.555 same minute or after @T23:55:25.900 false - + @T23:25:25.555 same second or after @T23:25:25.900 true - + @T23:25:35.555 same second or after @T22:25:25.900 true - + @T23:55:25.555 same second or after @T23:55:35.900 false - + @T23:25:25.555 same millisecond or after @T23:25:25.555 true - + @T23:25:25.555 same millisecond or after @T22:25:25.550 true - + @T23:55:25.555 same millisecond or after @T23:55:25.900 false - + @2017-12-20T11:00:00.000 on or after @2017-12-20T11:00:00.000 true - + @2017-12-21T02:00:00.0 same or after @2017-12-20T11:00:00.0 true - - + + DateTime(2014) same year or before DateTime(2014) true - + DateTime(2013) same year or before DateTime(2014) true - + DateTime(2015) same year or before DateTime(2014) false - + DateTime(2014, 12) same month or before DateTime(2014, 12) true - + DateTime(2014, 8) same month or before DateTime(2014, 9) true - + DateTime(2014, 12) same month or before DateTime(2014, 11) false - + DateTime(2014, 12, 20) same day or before DateTime(2014, 12, 20) true - + DateTime(2014, 10, 15) same day or before DateTime(2014, 10, 20) true - + DateTime(2014, 10, 30) same day or before DateTime(2014, 10, 25) false - + DateTime(2014, 12, 20, 12) same hour or before DateTime(2014, 12, 20, 12) true - + DateTime(2014, 10, 25, 5) same hour or before DateTime(2014, 10, 25, 10) true - + DateTime(2014, 10, 25, 20) same hour or before DateTime(2014, 10, 25, 15) false - + DateTime(2014, 12, 20, 12, 30) same minute or before DateTime(2014, 12, 20, 12, 30) true - + DateTime(2014, 10, 25, 10, 20) same minute or before DateTime(2014, 10, 25, 10, 25) true - + DateTime(2014, 10, 25, 15, 55) same minute or before DateTime(2014, 10, 25, 15, 45) false - + DateTime(2014, 12, 20, 12, 30, 15) same second or before DateTime(2014, 12, 20, 12, 30, 15) true - + DateTime(2014, 10, 25, 10, 25, 15) same second or before DateTime(2014, 10, 25, 10, 25, 20) true - + DateTime(2014, 10, 25, 15, 45, 25) same second or before DateTime(2014, 10, 25, 15, 45, 21) false - + DateTime(2014, 12, 20, 12, 30, 15, 250) same millisecond or before DateTime(2014, 12, 20, 12, 30, 15, 250) true - + DateTime(2014, 10, 25, 10, 25, 20, 450) same millisecond or before DateTime(2014, 10, 25, 10, 25, 20, 499) true - + DateTime(2014, 10, 25, 15, 45, 20, 505) same millisecond or before DateTime(2014, 10, 25, 15, 45, 20, 501) false - + DateTime(2014, 12, 20) same minute or before DateTime(2014, 12, 20, 15) null - + @2012-03-10T09:20:00.999+07:00 same hour or before @2012-03-10T10:20:00.999+06:00 true - + @2012-03-10T10:20:00.999+06:00 same hour or before @2012-03-10T10:20:00.999+07:00 false - + @T23:25:25.555 same hour or before @T23:55:25.900 true - + @T21:25:25.555 same hour or before @T22:55:25.900 true - + @T22:25:25.555 same hour or before @T21:55:25.900 false - + @T23:25:25.555 same minute or before @T23:25:25.900 true - + @T23:10:25.555 same minute or before @T22:15:25.900 false - + @T23:56:25.555 same minute or before @T23:55:25.900 false - + @T23:25:25.555 same second or before @T23:25:25.900 true - + @T23:25:35.555 same second or before @T22:25:45.900 false - + @T23:55:45.555 same second or before @T23:55:35.900 false - + @T23:25:25.555 same millisecond or before @T23:25:25.555 true - + @T23:25:25.200 same millisecond or before @T22:25:25.550 false - + @T23:55:25.966 same millisecond or before @T23:55:25.900 false - - + + DateTime(2005, 10, 10) - 5 years @2000-10-10T - + DateTime(2005, 10, 10) - 2005 years - + DateTime(2005, 6, 10) - 5 months @2005-01-10T - + DateTime(2005, 5, 10) - 6 months @2004-11-10T - + DateTime(2018, 5, 23) - 3 weeks = DateTime(2018, 5, 2) true + + + + + + DateTime(2018, 5, 23) - 52 weeks = DateTime(2017, 5, 24) + true + + + + + + DateTime(2024, 2, 29) - 52 weeks = DateTime(2023, 3, 2) + true + + + - - DateTime(2018, 5, 23) - 52 weeks = DateTime(2017, 5, 23) + + DateTime(2024, 3, 1) - 52 weeks = DateTime(2023, 3, 3) true + + + - + DateTime(2005, 5, 10) - 5 days @2005-05-05T - + DateTime(2016, 6, 10) - 11 days @2016-05-30T - + DateTime(2005, 5, 10, 10) - 5 hours @2005-05-10T05 - + DateTime(2016, 6, 10, 5) - 6 hours @2016-06-09T23 - + DateTime(2005, 5, 10, 5, 10) - 5 minutes @2005-05-10T05:05 - + DateTime(2016, 6, 10, 5, 5) - 6 minutes @2016-06-10T04:59 - + DateTime(2005, 5, 10, 5, 5, 10) - 5 seconds @2005-05-10T05:05:05 - + DateTime(2016,5) - 31535999 seconds = DateTime(2015, 5) true - + DateTime(2016, 10, 1, 10, 20, 30) - 15 hours @2016-09-30T19:20:30 - + DateTime(2016, 6, 10, 5, 5, 5) - 6 seconds @2016-06-10T05:04:59 - + DateTime(2005, 5, 10, 5, 5, 5, 10) - 5 milliseconds @2005-05-10T05:05:05.005 - + DateTime(2016, 6, 10, 5, 5, 5, 5) - 6 milliseconds @2016-06-10T05:05:04.999 - + DateTime(2014) - 24 months @2012T - + DateTime(2014) - 25 months @2012T - + Date(2014) - 24 months @2012 - + Date(2014) - 25 months @2012 - + Date(2014,6) - 33 days @2014-05 - + Date(2014,6) - 1 year @2013-06 - + @T15:59:59.999 - 5 hours @T10:59:59.999 - + @T15:59:59.999 - 1 minutes @T15:58:59.999 - + @T15:59:59.999 - 1 seconds @T15:59:58.999 - + @T15:59:59.0 - 1 milliseconds @T15:59:58.999 - + @T15:59:59.999 - 5 hours - 1 minutes @T10:58:59.999 - + @T15:59:59.999 - 300 minutes @T10:59:59.999 - - + + @T23:59:59.999 @T23:59:59.999 - - + + TimeOfDay() = TimeOfDay() true - - + + Today() same day or before Today() true - + Today() same day or before Today() + 1 days true - + Today() + 1 years same day or before Today() false - + Today() + 1 days > Today() true - + Today() = Today() true diff --git a/test/spec-tests/xml/CqlErrorsAndMessagingOperatorsTest.xml b/test/spec-tests/xml/CqlErrorsAndMessagingOperatorsTest.xml index 6c6cc03b..6ff7602c 100644 --- a/test/spec-tests/xml/CqlErrorsAndMessagingOperatorsTest.xml +++ b/test/spec-tests/xml/CqlErrorsAndMessagingOperatorsTest.xml @@ -1,20 +1,20 @@ - - - + + + Message(1, true, '100', 'Message', 'Test Message') 1 - + Message(2, true, '200', 'Warning', 'You have been warned!') 2 - + Message({3, 4, 5}, true, '300', 'Trace', 'This is a trace') {3, 4, 5} - + Message(3 + 1, true, '400', 'Error', 'This is an error!') diff --git a/test/spec-tests/xml/CqlIntervalOperatorsTest.xml b/test/spec-tests/xml/CqlIntervalOperatorsTest.xml index 77b4c965..c7072ec1 100644 --- a/test/spec-tests/xml/CqlIntervalOperatorsTest.xml +++ b/test/spec-tests/xml/CqlIntervalOperatorsTest.xml @@ -1,556 +1,630 @@ - - + name="CqlIntervalOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#interval-operators-3" version="1.0"> + + (null as Integer) after Interval[1, 10] null - + Interval[11, 20] after Interval[1, 10] true - + Interval[1, 10] after Interval[11, 20] false - + 12 after Interval[1, 10] true - + 9 after Interval[1, 10] false - + Interval[11, 20] after 5 true - + Interval[11, 20] after 12 false - + Interval[11.0, 20.0] after Interval[1.0, 10.0] true - + Interval[1.0, 10.0] after Interval[11.0, 20.0] false - + 12.0 after Interval[1.0, 10.0] true - + 9.0 after Interval[1.0, 10.0] false - + Interval[11.0, 20.0] after 5.0 true - + Interval[11.0, 20.0] after 12.0 false - + Interval[11.0 'g', 20.0 'g'] after Interval[1.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] after Interval[11.0 'g', 20.0 'g'] false - + 12.0'g' after Interval[1.0 'g', 10.0 'g'] true - + 9.0'g' after Interval[1.0 'g', 10.0 'g'] false - + Interval[11.0 'g', 20.0 'g'] after 5.0'g' true - + Interval[11.0 'g', 20.0 'g'] after 12.0'g' false - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] after DateTime(2011, 12, 31) true - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] after DateTime(2012, 12, 31) false - + Interval[@T15:59:59.999, @T20:59:59.999] after @T12:59:59.999 true - + Interval[@T15:59:59.999, @T20:59:59.999] after @T17:59:59.999 false - - + + (null as Integer) before Interval[1, 10] null - + Interval[11, 20] before Interval[1, 10] false - + Interval[1, 10] before Interval[11, 20] true - + 9 before Interval[11, 20] true - + 9 before Interval[1, 10] false - + Interval[1, 10] before 11 true - + Interval[1, 10] before 8 false - + Interval[11.0, 20.0] before Interval[1.0, 10.0] false - + Interval[1.0, 10.0] before Interval[11.0, 20.0] true - + 9.0 before Interval[11.0, 20.0] true - + 9.0 before Interval[1.0, 10.0] false - + Interval[1.0, 10.0] before 11.0 true - + Interval[1.0, 10.0] before 8.0 false - + Interval[1.0 'g', 10.0 'g'] before Interval[11.0 'g', 20.0 'g'] true - + Interval[11.0 'g', 20.0 'g'] before Interval[1.0 'g', 10.0 'g'] false - + Interval[1.0 'g', 10.0 'g'] before 12.0'g' true - + Interval[1.0 'g', 10.0 'g'] before 9.0'g' false - + 5.0'g' before Interval[11.0 'g', 20.0 'g'] true - + 12.0'g' before Interval[11.0 'g', 20.0 'g'] false - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] before DateTime(2012, 2, 27) true - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] before DateTime(2011, 12, 31) false - + Interval[@T15:59:59.999, @T20:59:59.999] before @T22:59:59.999 true - + Interval[@T15:59:59.999, @T20:59:59.999] before @T10:59:59.999 false - - + + collapse {Interval(null, null)} { } - + collapse { Interval[1,5], Interval[3,7], Interval[12,19], Interval[7,10] } {Interval [ 1, 10 ], Interval [ 12, 19 ]} - + collapse { Interval[1,2], Interval[3,7], Interval[10,19], Interval[7,10] } {Interval [ 1, 19 ]} - + collapse { Interval[4,6], Interval[7,8] } {Interval [ 4, 8 ]} - + collapse { Interval[1.0,5.0], Interval[3.0,7.0], Interval[12.0,19.0], Interval[7.0,10.0] } {Interval [ 1.0, 10.0 ], Interval [ 12.0, 19.0 ]} - + collapse { Interval[4.0,6.0], Interval[6.00000001,8.0] } {Interval [ 4.0, 8.0 ]} - + collapse { Interval[1.0 'g',5.0 'g'], Interval[3.0 'g',7.0 'g'], Interval[12.0 'g',19.0 'g'], Interval[7.0 'g',10.0 'g'] } {Interval [ 1.0 'g', 10.0 'g' ], Interval [ 12.0 'g', 19.0 'g' ]} - + collapse { Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)], Interval[DateTime(2012, 1, 10), DateTime(2012, 1, 25)], Interval[DateTime(2012, 5, 10), DateTime(2012, 5, 25)], Interval[DateTime(2012, 5, 20), DateTime(2012, 5, 30)] } {Interval [ @2012-01-01T, @2012-01-25T ], Interval [ @2012-05-10T, @2012-05-30T ]} - + collapse { Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)], Interval[DateTime(2012, 1, 16), DateTime(2012, 5, 25)] } {Interval [ @2012-01-01T, @2012-05-25T ]} - + collapse { Interval[@T01:59:59.999, @T10:59:59.999], Interval[@T08:59:59.999, @T15:59:59.999], Interval[@T17:59:59.999, @T20:59:59.999], Interval[@T18:59:59.999, @T22:59:59.999] } {Interval [ @T01:59:59.999, @T15:59:59.999 ], Interval [ @T17:59:59.999, @T22:59:59.999 ]} - + collapse { Interval[@T01:59:59.999, @T10:59:59.999], Interval[@T11:00:00.000, @T15:59:59.999] } {Interval [ @T01:59:59.999, @T15:59:59.999 ]} - - + + + expand null + null + + + expand { } + { } + + + expand { null } + { } + + expand { Interval[@2018-01-01, @2018-01-04] } per day { Interval[@2018-01-01, @2018-01-01], Interval[@2018-01-02, @2018-01-02], Interval[@2018-01-03, @2018-01-03], Interval[@2018-01-04, @2018-01-04] } - + + expand Interval[@2018-01-01, @2018-01-04] per day + { @2018-01-01, @2018-01-02, @2018-01-03, @2018-01-04 } + + expand { Interval[@2018-01-01, @2018-01-04] } per 2 days { Interval[@2018-01-01, @2018-01-02], Interval[@2018-01-03, @2018-01-04] } - + + expand Interval[@2018-01-01, @2018-01-04] per 2 days + { @2018-01-01, @2018-01-03 } + + expand { Interval[@T10:00, @T12:30] } per hour - { Interval[@T10:00, @T11:00), Interval[@T11:00, @T12:00) } + { Interval[@T10, @T10], Interval[@T11, @T11], Interval[@T12, @T12] } + + + expand Interval[@T10:00, @T12:30] per hour + { @T10, @T11, @T12 } - + + expand { Interval[@T10:00, @T12:30) } per hour + { Interval[@T10, @T10], Interval[@T11, @T11], Interval[@T12, @T12] } + + + expand Interval[@T10:00, @T12:30) per hour + { @T10, @T11, @T12 } + + expand { Interval[10.0, 12.5] } per 1 { Interval[10, 10], Interval[11, 11], Interval[12, 12] } - - + + expand Interval[10.0, 12.5] per 1 + { 10, 11, 12 } + + + expand { Interval[10.0, 12.5) } per 1 + { Interval[10, 10], Interval[11, 11], Interval[12, 12] } + + + expand Interval[10.0, 12.5) per 1 + { 10, 11, 12 } + + expand { Interval[@T10, @T10] } per minute { } - + + expand Interval[@T10, @T10] per minute + { } + + expand { Interval[10, 10] } per 0.1 { Interval[10.0, 10.0], Interval[10.1, 10.1], Interval[10.2, 10.2], Interval[10.3, 10.3], Interval[10.4, 10.4], Interval[10.5, 10.5], Interval[10.6, 10.6], Interval[10.7, 10.7], Interval[10.8, 10.8], Interval[10.9, 10.9] } - - + + expand Interval[10, 10] per 0.1 + { 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9 } + + expand { Interval[1, 10] } { Interval[1, 1], Interval[2, 2], Interval[3, 3], Interval[4, 4], Interval[5, 5], Interval[6, 6], Interval[7, 7], Interval[8, 8], Interval[9, 9], Interval[10, 10] } - + + expand Interval[1, 10] + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } + + + expand { Interval[1, 10) } + { Interval[1, 1], Interval[2, 2], Interval[3, 3], Interval[4, 4], Interval[5, 5], Interval[6, 6], Interval[7, 7], Interval[8, 8], Interval[9, 9] } + + + expand Interval[1, 10) + { 1, 2, 3, 4, 5, 6, 7, 8, 9 } + + expand { Interval[1, 10] } per 2 { Interval[1, 2], Interval[3, 4], Interval[5, 6], Interval[7, 8], Interval[9, 10] } + + expand Interval[1, 10] per 2 + { 1, 3, 5, 7, 9 } + + + expand { Interval[1, 10) } per 2 + { Interval[1, 2], Interval[3, 4], Interval[5, 6], Interval[7, 8] } + + + expand Interval[1, 10) per 2 + { 1, 3, 5, 7 } + - - + + Interval[1, 10] contains null null - + null contains 5 false - + Interval[null, 5] contains 10 false - + Interval[1, 10] contains 5 true - + Interval[1, 10] contains 25 false - + Interval[1.0, 10.0] contains 8.0 true - + Interval[1.0, 10.0] contains 255.0 false - + Interval[1.0 'g', 10.0 'g'] contains 2.0 'g' true - + Interval[1.0 'g', 10.0 'g'] contains 100.0 'g' false - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] contains DateTime(2012, 1, 10) true - + Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] contains DateTime(2012, 1, 16) false - + Interval[@T01:59:59.999, @T10:59:59.999] contains @T05:59:59.999 true - + Interval[@T01:59:59.999, @T10:59:59.999] contains @T15:59:59.999 false - - + + end of Interval[1, 10] 10 - + end of Interval[1.0, 10.0] 10.0 - + end of Interval[1.0 'g', 10.0 'g'] 10.0'g' - + end of Interval[@2016-05-01T00:00:00.000, @2016-05-02T00:00:00.000] @2016-05-02T00:00:00.000 - + end of Interval[@T00:00:00.000, @T23:59:59.599] @T23:59:59.599 - - + + Interval[1, 10] ends Interval(null, null) null - + Interval[4, 10] ends Interval[1, 10] true - + Interval[44, 50] ends Interval[1, 10] false - + Interval[4.0, 10.0] ends Interval[1.0, 10.0] true - + Interval[11.0, 20.0] ends Interval[1.0, 10.0] false - + Interval[5.0 'g', 10.0 'g'] ends Interval[1.0 'g', 10.0 'g'] true - + Interval[11.0 'g', 20.0 'g'] ends Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] ends Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 15)] true - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] ends Interval[DateTime(2012, 1, 1), DateTime(2012, 1, 16)] false - + Interval[@T05:59:59.999, @T10:59:59.999] ends Interval[@T01:59:59.999, @T10:59:59.999] true - + Interval[@T05:59:59.999, @T10:59:59.999] ends Interval[@T01:59:59.999, @T11:59:59.999] false - - + + Interval[1, 10] = Interval(null, null) null - + Interval[1, 10] = Interval[1, 10] true - + Interval[1, 10] = Interval[11, 20] false - + Interval[1.0, 10.0] = Interval[1.0, 10.0] true - + Interval[1.0, 10.0] = Interval[11.0, 20.0] false - + Interval[1.0 'g', 10.0 'g'] = Interval[1.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] = Interval[11.0 'g', 20.0 'g'] false - + Interval[DateTime(2012, 1, 5, 0, 0, 0, 0), DateTime(2012, 1, 15, 0, 0, 0, 0)] = Interval[DateTime(2012, 1, 5, 0, 0, 0, 0), DateTime(2012, 1, 15, 0, 0, 0, 0)] true - + Interval[DateTime(2012, 1, 5, 0, 0, 0, 0), DateTime(2012, 1, 15, 0, 0, 0, 0)] = Interval[DateTime(2012, 1, 5, 0, 0, 0, 0), DateTime(2012, 1, 16, 0, 0, 0, 0)] false - + Interval[@T05:59:59.999, @T10:59:59.999] = Interval[@T05:59:59.999, @T10:59:59.999] true - + Interval[@T05:59:59.999, @T10:59:59.999] = Interval[@T05:59:59.999, @T10:58:59.999] false - - + + Interval[null, null] null - + Interval[null, null] except Interval[null, null] null - + Interval[1, 10] except Interval[4, 10] Interval [ 1, 3 ] - + Interval[1, 10] except Interval[3, 7] null - + Interval[1.0, 10.0] except Interval[4.0, 10.0] Interval [ 1.0, 3.99999999 ] - + Interval[1.0, 10.0] except Interval[3.0, 7.0] null - + Interval[1.0 'g', 10.0 'g'] except Interval[5.0 'g', 10.0 'g'] Interval [ 1.0 'g', 4.99999999 'g' ] - + Interval[1, 4] except Interval[3, 6] Interval [ 1, 2 ] - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] except Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 15)] Interval [ @2012-01-05T, @2012-01-06T ] - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 16)] except Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 12)] Interval [ @2012-01-13T, @2012-01-16T ] - + Interval[@T05:59:59.999, @T10:59:59.999] except Interval[@T08:59:59.999, @T10:59:59.999] Interval [ @T05:59:59.999, @T08:59:59.998 ] - + Interval[@T08:59:59.999, @T11:59:59.999] except Interval[@T05:59:59.999, @T10:59:59.999] Interval [ @T11:00:00.000, @T11:59:59.999 ] - - + + 5 in Interval[null, null] false - + 5 in Interval[1, 10] true - + 500 in Interval[1, 10] false - + 9.0 in Interval[1.0, 10.0] true - + -2.0 in Interval[1.0, 10.0] false - + 1.0 'g' in Interval[1.0 'g', 10.0 'g'] true - + 55.0 'g' in Interval[1.0 'g', 10.0 'g'] false - + DateTime(2012, 1, 7) in Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] true - + DateTime(2012, 1, 17) in Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] false - + DateTime(2012, 1, 7) in Interval[DateTime(2012, 1, 5), null] true - + @T07:59:59.999 in Interval[@T05:59:59.999, @T10:59:59.999] true - + @T17:59:59.999 in Interval[@T05:59:59.999, @T10:59:59.999] false - + null in Interval[@T05:59:59.999, @T10:59:59.999] null - + Interval[@2017-12-20T11:00:00, @2017-12-21T21:00:00] Interval [ @2017-12-20T11:00:00, @2017-12-21T21:00:00 ] - + Interval[@2017-12-20T10:30:00, @2017-12-20T12:00:00] Interval [ @2017-12-20T10:30:00, @2017-12-20T12:00:00 ] - + Interval[@2017-12-20T10:30:00, @2017-12-20T12:00:00] starts 1 day or less on or after day of start of @@ -559,1102 +633,1102 @@ true - - + + Interval[1, 10] includes null null - + Interval[1, 10] includes Interval[4, 10] true - + Interval[1, 10] includes Interval[44, 50] false - + Interval[1.0, 10.0] includes Interval[4.0, 10.0] true - + Interval[1.0, 10.0] includes Interval[11.0, 20.0] false - + Interval[1.0 'g', 10.0 'g'] includes Interval[5.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] includes Interval[11.0 'g', 20.0 'g'] false - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] includes Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] true - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] includes Interval[DateTime(2012, 1, 4), DateTime(2012, 1, 14)] false - + Interval[@T05:59:59.999, @T10:59:59.999] includes Interval[@T06:59:59.999, @T09:59:59.999] true - + Interval[@T05:59:59.999, @T10:59:59.999] includes Interval[@T04:59:59.999, @T09:59:59.999] false - - + + null included in Interval[1, 10] null - + Interval[4, 10] included in Interval[1, 10] true - + Interval[44, 50] included in Interval[1, 10] false - + Interval[4.0, 10.0] included in Interval[1.0, 10.0] true - + Interval[11.0, 20.0] included in Interval[1.0, 10.0] false - + Interval[5.0 'g', 10.0 'g'] included in Interval[1.0 'g', 10.0 'g'] true - + Interval[11.0 'g', 20.0 'g'] included in Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] included in Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] true - + Interval[DateTime(2012, 1, 4), DateTime(2012, 1, 14)] included in Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 15)] false - + Interval[@T06:59:59.999, @T09:59:59.999] included in Interval[@T05:59:59.999, @T10:59:59.999] true - + Interval[@T04:59:59.999, @T09:59:59.999] included in Interval[@T05:59:59.999, @T10:59:59.999] false - + Interval [@2017-09-01T00:00:00, @2017-09-01T00:00:00] included in Interval [@2017-09-01T00:00:00.000, @2017-12-30T23:59:59.999] null - + Interval [@2017-09-01T00:00:00, @2017-09-01T00:00:00] included in day of Interval [@2017-09-01T00:00:00.000, @2017-12-30T23:59:59.999] true - + Interval [@2017-09-01T00:00:00, @2017-09-01T00:00:00] included in millisecond of Interval [@2017-09-01T00:00:00.000, @2017-12-30T23:59:59.999] null - - + + Interval[1, 10] intersect Interval[5, null) Interval[5, null) - + start of (Interval[1, 10] intersect Interval[5, null)) <= 10 true - + start of (Interval[1, 10] intersect Interval[5, null)) >= 5 true - + start of (Interval[1, 10] intersect Interval[5, null)) > 10 false - + start of (Interval[1, 10] intersect Interval[5, null)) < 5 false - + Interval[1, 10] intersect Interval[4, 10] Interval [ 4, 10 ] - + Interval[1, 10] intersect Interval[11, 20] null - + Interval[1.0, 10.0] intersect Interval[4.0, 10.0] Interval [ 4.0, 10.0 ] - + Interval[1.0, 10.0] intersect Interval[11.0, 20.0] null - + Interval[1.0 'g', 10.0 'g'] intersect Interval[5.0 'g', 10.0 'g'] Interval [ 5.0 'g', 10.0 'g' ] - + Interval[1.0 'g', 10.0 'g'] intersect Interval[11.0 'g', 20.0 'g'] null - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] intersect Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 10)] Interval [ @2012-01-07T, @2012-01-10T ] - + Interval[@T04:59:59.999, @T09:59:59.999] intersect Interval[@T04:59:59.999, @T06:59:59.999] Interval [ @T04:59:59.999, @T06:59:59.999 ] - - + + Interval[1, 10] ~ Interval[1, 10] true - + Interval[44, 50] ~ Interval[1, 10] false - + Interval[1.0, 10.0] ~ Interval[1.0, 10.0] true - + Interval[11.0, 20.0] ~ Interval[1.0, 10.0] false - + Interval[1.0 'g', 10.0 'g'] ~ Interval[1.0 'g', 10.0 'g'] true - + Interval[11.0 'g', 20.0 'g'] ~ Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] ~ Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] true - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] ~ Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 15)] false - + Interval[@T04:59:59.999, @T09:59:59.999] ~ Interval[@T04:59:59.999, @T09:59:59.999] true - + Interval[@T04:59:59.999, @T09:59:59.999] ~ Interval[@T04:58:59.999, @T09:59:59.999] false - - + + Interval(null, 5] meets Interval(null, 15) null - + Interval[1, 10] meets Interval[11, 20] true - + Interval[1, 10] meets Interval[44, 50] false - + Interval[3.01, 5.00000001] meets Interval[5.00000002, 8.50] true - + Interval[3.01, 5.00000001] meets Interval[5.5, 8.50] false - + Interval[3.01 'g', 5.00000001 'g'] meets Interval[5.00000002 'g', 8.50 'g'] true - + Interval[3.01 'g', 5.00000001 'g'] meets Interval[5.5 'g', 8.50 'g'] false - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] meets Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 25)] true - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] meets Interval[DateTime(2012, 1, 20), DateTime(2012, 1, 25)] false - + Interval[@T04:59:59.999, @T09:59:59.999] meets Interval[@T10:00:00.000, @T19:59:59.999] true - + Interval[@T04:59:59.999, @T09:59:59.999] meets Interval[@T10:12:00.000, @T19:59:59.999] false - - + + Interval(null, 5] meets before Interval(null, 25] null - + Interval[1, 10] meets before Interval[11, 20] true - + Interval[1, 10] meets before Interval[44, 50] false - + Interval[3.50000001, 5.00000011] meets before Interval[5.00000012, 8.50] true - + Interval[8.01, 15.00000001] meets before Interval[15.00000000, 18.50] false - + Interval[3.50000001 'g', 5.00000011 'g'] meets before Interval[5.00000012 'g', 8.50 'g'] true - + Interval[8.01 'g', 15.00000001 'g'] meets before Interval[15.00000000 'g', 18.50 'g'] false - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] meets Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 25)] true - + Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] meets Interval[DateTime(2012, 1, 20), DateTime(2012, 1, 25)] false - + Interval[@T04:59:59.999, @T09:59:59.999] meets Interval[@T10:00:00.000, @T19:59:59.999] true - + Interval[@T04:59:59.999, @T09:59:59.999] meets Interval[@T10:12:00.000, @T19:59:59.999] false - - + + Interval(null, 5] meets after Interval[11, null) false - + Interval[11, 20] meets after Interval[1, 10] true - + Interval[44, 50] meets after Interval[1, 10] false - + Interval[55.00000123, 128.032156] meets after Interval[12.00258, 55.00000122] true - + Interval[55.00000124, 150.222222] meets after Interval[12.00258, 55.00000122] false - + Interval[55.00000123 'g', 128.032156 'g'] meets after Interval[12.00258 'g', 55.00000122 'g'] true - + Interval[55.00000124 'g', 150.222222 'g'] meets after Interval[12.00258 'g', 55.00000122 'g'] false - + Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 25)] meets Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] true - + Interval[DateTime(2012, 1, 20), DateTime(2012, 1, 25)] meets Interval[DateTime(2012, 1, 7), DateTime(2012, 1, 14)] false - + Interval[@T10:00:00.000, @T19:59:59.999] meets Interval[@T04:59:59.999, @T09:59:59.999] true - + Interval[@T10:12:00.000, @T19:59:59.999] meets Interval[@T04:59:59.999, @T09:59:59.999] false - - + + Interval[1, 10] != Interval[11, 20] true - + Interval[1, 10] != Interval[1, 10] false - + Interval[1.0, 10.0] != Interval[11.0, 20.0] true - + Interval[1.0, 10.0] != Interval[1.0, 10.0] false - + Interval[1.0 'g', 10.0 'g'] != Interval[11.0 'g', 20.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] != Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 15, 0, 0, 0, 0), DateTime(2012, 1, 25, 0, 0, 0, 0)] != Interval[DateTime(2012, 1, 15, 0, 0, 0, 0), DateTime(2012, 1, 25, 0, 0, 0, 22)] true - + Interval[DateTime(2012, 1, 15, 0, 0, 0, 0), DateTime(2012, 1, 25, 0, 0, 0, 0)] != Interval[DateTime(2012, 1, 15, 0, 0, 0, 0), DateTime(2012, 1, 25, 0, 0, 0, 0)] false - + Interval[@T10:00:00.000, @T19:59:59.999] != Interval[@T10:10:00.000, @T19:59:59.999] true - + Interval[@T10:00:00.000, @T19:59:59.999] != Interval[@T10:00:00.000, @T19:59:59.999] false - - + + Interval[@2012-12-01, @2013-12-01] on or after (null as Interval<Date>) null - + Interval[@2012-12-01, @2013-12-01] on or after month of @2012-11-15 true - + @2012-11-15 on or after month of Interval[@2012-12-01, @2013-12-01] false - + Interval[@T10:00:00.000, @T19:59:59.999] on or after hour of Interval[@T08:00:00.000, @T09:59:59.999] true - + Interval[@T10:00:00.000, @T19:59:59.999] on or after hour of Interval[@T08:00:00.000, @T11:59:59.999] false - + Interval[6, 10] on or after 6 true - + 2.5 on or after Interval[1.666, 2.50000001] false - + 2.5 'mg' on or after Interval[1.666 'mg', 2.50000000 'mg'] true - - + + Interval[@2012-12-01, @2013-12-01] on or before (null as Interval<Date>) null - + Interval[@2012-10-01, @2012-11-01] on or before month of @2012-11-15 true - + @2012-11-15 on or before month of Interval[@2012-10-01, @2013-12-01] false - + Interval[@T05:00:00.000, @T07:59:59.999] on or before hour of Interval[@T08:00:00.000, @T09:59:59.999] true - + Interval[@T10:00:00.000, @T19:59:59.999] on or before hour of Interval[@T08:00:00.000, @T11:59:59.999] false - + Interval[4, 6] on or before 6 true - + 1.6667 on or before Interval[1.666, 2.50000001] false - + 1.666 'mg' on or before Interval[1.666 'mg', 2.50000000 'mg'] true - - + + Interval[null, null] overlaps Interval[1, 10] null - + Interval[1, 10] overlaps Interval[4, 10] true - + Interval[4, 10] overlaps Interval[4, 10] true - + Interval[10, 15] overlaps Interval[4, 10] true - + Interval[1, 10] overlaps Interval[11, 20] false - + Interval[4, 10) overlaps Interval[4, 10) true - + Interval[4, 11) overlaps Interval[10, 20] true - + Interval[4, 10] overlaps Interval(9, 20] true - + Interval[4, 11) overlaps Interval(9, 20] true - + Interval[4, 10] overlaps Interval(10, 20] false - + Interval[4, 10) overlaps Interval[10, 20] false - + Interval[4, 10) overlaps Interval(10, 20] false - + Interval[4, 10) overlaps Interval(9, 20] false - + Interval[1.0, 10.0] overlaps Interval[4.0, 10.0] true - + Interval[1.0, 10.0] overlaps Interval[11.0, 20.0] false - + Interval[1.0 'g', 10.0 'g'] overlaps Interval[5.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] overlaps Interval[11.0 'g', 20.0 'g'] false - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] overlaps Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] true - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] overlaps Interval[DateTime(2012, 1, 26), DateTime(2012, 1, 28)] false - + Interval[DateTime(2012, 2, 25), DateTime(2012, 3, 26)] overlaps Interval[DateTime(2012, 1, 10), DateTime(2012, 2)] null - + Interval[DateTime(2012, 1, 25), DateTime(2012, 2, 26)] overlaps Interval[DateTime(2012, 2), DateTime(2012, 3, 28)] null - + Interval[DateTime(2012, 2), DateTime(2012, 3)] overlaps Interval[DateTime(2011, 1, 10), DateTime(2012)] null - + Interval[DateTime(2012), DateTime(2013, 3)] overlaps Interval[DateTime(2012, 2), DateTime(2013, 2)] true - + Interval[DateTime(2012, 2), DateTime(2013)] overlaps Interval[DateTime(2012, 3), DateTime(2013, 2)] true - + Interval[@T10:00:00.000, @T19:59:59.999] overlaps Interval[@T12:00:00.000, @T21:59:59.999] true - + Interval[@T10:00:00.000, @T19:59:59.999] overlaps Interval[@T20:00:00.000, @T21:59:59.999] false - - + + Interval[null, null] overlaps before Interval[1, 10] null - + Interval[1, 10] overlaps before Interval[4, 10] true - + Interval[4, 10] overlaps before Interval[1, 10] false - + Interval[4, 10] overlaps before Interval[4, 10] false - + Interval[4, 10] overlaps before Interval(4, 10] true - + Interval(3, 10] overlaps before Interval(4, 10] true - + Interval(3, 10] overlaps before Interval[5, 10] true - + Interval(3, 10] overlaps before Interval(3, 10] false - + Interval(3, 10] overlaps before Interval[4, 10] false - + Interval[4, 10] overlaps before Interval(3, 10] false - + Interval[1.0, 10.0] overlaps before Interval[4.0, 10.0] true - + Interval[4.0, 10.0] overlaps before Interval[1.0, 10.0] false - + Interval[1.0 'g', 10.0 'g'] overlaps before Interval[5.0 'g', 10.0 'g'] true - + Interval[5.0 'g', 10.0 'g'] overlaps before Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] overlaps Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] true - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] overlaps Interval[DateTime(2012, 1, 26), DateTime(2012, 1, 28)] false - + Interval[@T10:00:00.000, @T19:59:59.999] overlaps Interval[@T12:00:00.000, @T21:59:59.999] true - + Interval[@T10:00:00.000, @T19:59:59.999] overlaps Interval[@T20:00:00.000, @T21:59:59.999] false - - + + Interval[null, null] overlaps after Interval[1, 10] null - + Interval[4, 15] overlaps after Interval[1, 10] true - + Interval[4, 10] overlaps after Interval[1, 10] false - + Interval[4, 10] overlaps after Interval[4, 10] false - + Interval[4, 11) overlaps after Interval[4, 9] true - + Interval[4, 11) overlaps after Interval[4, 10) true - + Interval[4, 10] overlaps after Interval[4, 10) true - + Interval[4, 11) overlaps after Interval[4, 11) false - + Interval[4, 11) overlaps after Interval[4, 10] false - + Interval[4, 10] overlaps after Interval[4, 11) false - + Interval[4.0, 15.0] overlaps after Interval[1.0, 10.0] true - + Interval[4.0, 10.0] overlaps after Interval[1.0, 10.0] false - + Interval[5.0 'g', 15.0 'g'] overlaps after Interval[1.0 'g', 10.0 'g'] true - + Interval[5.0 'g', 10.0 'g'] overlaps after Interval[1.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] overlaps Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] true - + Interval[DateTime(2012, 1, 26), DateTime(2012, 1, 28)] overlaps Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] false - + Interval[@T12:00:00.000, @T21:59:59.999] overlaps Interval[@T10:00:00.000, @T19:59:59.999] true - + Interval[@T20:00:00.000, @T21:59:59.999] overlaps Interval[@T10:00:00.000, @T19:59:59.999] false - - + + point from Interval[null, null] null - + point from Interval[1, 1] 1 - + point from Interval[1.0, 1.0] 1.0 - + point from Interval[1.0 'cm', 1.0 'cm'] 1.0'cm' - - + + Interval[@T12:00:00.000, @T21:59:59.999] properly includes @T12:00:00.001 true - + Interval[@T12:00:00.000, @T21:59:59.999] properly includes @T12:00:00.000 false - + Interval[@T12:00:00.001, @T21:59:59.999] properly includes @T12:00:00 null - + Interval[@T12:00:00.000, @T21:59:59.999] properly includes second of @T12:00:01 true - + Interval[@T12:00:00.001, @T21:59:59.999] properly includes second of @T12:00:00 false - + Interval[@T12:00:00.001, @T21:59:59.999] properly includes millisecond of @T12:00:00 null - - + + @T12:00:00.001 properly included in Interval[@T12:00:00.000, @T21:59:59.999] true - + @T12:00:00.000 properly included in Interval[@T12:00:00.000, @T21:59:59.999] false - + @T12:00:00 properly included in Interval[@T12:00:00.001, @T21:59:59.999] null - + @T12:00:01 properly included in second of Interval[@T12:00:00.000, @T21:59:59.999] true - + @T12:00:00 properly included in second of Interval[@T12:00:00.001, @T21:59:59.999] false - + @T12:00:00 properly included in millisecond of Interval[@T12:00:00.001, @T21:59:59.999] null - - + + Interval[null as Integer, null as Integer] properly includes Interval[1, 10] true - + Interval[1, 10] properly includes Interval[4, 10] true - + Interval[1, 10] properly includes Interval[4, 15] false - + Interval[1.0, 10.0] properly includes Interval[4.0, 10.0] true - + Interval[1.0, 10.0] properly includes Interval[4.0, 15.0] false - + Interval[1.0 'g', 10.0 'g'] properly includes Interval[5.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] properly includes Interval[5.0 'g', 15.0 'g'] false - + Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] properly includes Interval[DateTime(2012, 1, 16), DateTime(2012, 1, 27)] true - + Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] properly includes Interval[DateTime(2012, 1, 16), DateTime(2012, 1, 29)] false - + Interval[@T12:00:00.000, @T21:59:59.999] properly includes Interval[@T12:01:01.000, @T21:59:59.998] true - + Interval[@T12:00:00.000, @T21:59:59.999] properly includes Interval[@T12:01:01.000, @T22:00:00.000] false - - + + Interval[1, 10] properly included in Interval[null, null] true - + Interval[4, 10] properly included in Interval[1, 10] true - + Interval[4, 15] properly included in Interval[1, 10] false - + Interval[4.0, 10.0] properly included in Interval[1.0, 10.0] true - + Interval[4.0, 15.0] properly included in Interval[1.0, 10.0] false - + Interval[5.0 'g', 10.0 'g'] properly included in Interval[1.0 'g', 10.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] properly included in Interval[5.0 'g', 15.0 'g'] false - + Interval[DateTime(2012, 1, 16), DateTime(2012, 1, 27)] properly included in Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] true - + Interval[DateTime(2012, 1, 16), DateTime(2012, 1, 29)] properly included in Interval[DateTime(2012, 1, 15), DateTime(2012, 1, 28)] false - + Interval[@T12:01:01.000, @T21:59:59.998] properly included in Interval[@T12:00:00.000, @T21:59:59.999] true - + Interval[@T12:01:01.000, @T22:00:00.000] properly included in Interval[@T12:00:00.000, @T21:59:59.999] false - - + + start of Interval[1, 10] 1 - + start of Interval[1.0, 10.0] 1.0 - + start of Interval[1.0 'g', 10.0 'g'] 1.0'g' - + start of Interval[@2016-05-01T00:00:00.000, @2016-05-02T00:00:00.000] @2016-05-01T00:00:00.000 - + start of Interval[@T00:00:00.000, @T23:59:59.599] @T00:00:00.000 - - + + Interval[null, null] starts Interval[1, 10] null - + Interval[4, 10] starts Interval[4, 15] true - + Interval[1, 10] starts Interval[4, 10] false - + Interval[4.0, 10.0] starts Interval[4.0, 15.0] true - + Interval[1.0, 10.0] starts Interval[4.0, 10.0] false - + Interval[5.0 'g', 10.0 'g'] starts Interval[5.0 'g', 15.0 'g'] true - + Interval[1.0 'g', 10.0 'g'] starts Interval[5.0 'g', 10.0 'g'] false - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] starts Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 27)] true - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] starts Interval[DateTime(2012, 1, 6), DateTime(2012, 1, 27)] false - + Interval[@T05:59:59.999, @T15:59:59.999] starts Interval[@T05:59:59.999, @T17:59:59.999] true - + Interval[@T05:59:59.999, @T15:59:59.999] starts Interval[@T04:59:59.999, @T17:59:59.999] false - - + + Interval[null, null] union Interval[1, 10] null - + Interval[1, 10] union Interval[4, 15] Interval [ 1, 15 ] - + Interval[1, 10] union Interval[44, 50] null - + Interval[1.0, 10.0] union Interval[4.0, 15.0] Interval [ 1.0, 15.0 ] - + Interval[1.0, 10.0] union Interval[14.0, 15.0] null - + Interval[1.0 'g', 10.0 'g'] union Interval[5.0 'g', 15.0 'g'] Interval [ 1.0 'g', 15.0 'g' ] - + Interval[1.0 'g', 10.0 'g'] union Interval[14.0 'g', 15.0 'g'] null - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] union Interval[DateTime(2012, 1, 25), DateTime(2012, 1, 28)] Interval [ @2012-01-05T, @2012-01-28T ] - + Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] union Interval[DateTime(2012, 1, 27), DateTime(2012, 1, 28)] null - + Interval[@T05:59:59.999, @T15:59:59.999] union Interval[@T10:59:59.999, @T20:59:59.999] Interval [ @T05:59:59.999, @T20:59:59.999 ] - + Interval[@T05:59:59.999, @T15:59:59.999] union Interval[@T16:59:59.999, @T20:59:59.999] null - - + + width of Interval[1, 10] 9 - + width of (null as Interval<Any>) null - + width of Interval[4.0, 15.0] 11.0 - + width of Interval[5.0 'g', 10.0 'g'] 5.0'g' - + width of Interval[DateTime(2012, 1, 5), DateTime(2012, 1, 25)] - + width of Interval[@T05:59:59.999, @T15:59:59.999] - - + + Interval[1, 10] Interval[1, 10] - + Interval[11, 20] Interval[11, 20] - + Interval[44, 50] Interval[44, 50] - + Interval[4, 10] Interval[4, 10] - + Interval[4, 15] Interval[4, 15] - + Interval[1.0, 10.0] Interval[1.0, 10.0] - + Interval[11.0, 20.0] Interval[11.0, 20.0] - + Interval[4.0, 10.0] Interval[4.0, 10.0] - + Interval[4.0, 15.0] Interval[4.0, 15.0] - + Interval[14.0, 15.0] Interval[14.0, 15.0] - + Interval[1.0 'g', 10.0 'g'] Interval[1.0 'g', 10.0 'g'] - + Interval[11.0 'g', 20.0 'g'] Interval[11.0 'g', 20.0 'g'] - + Interval[5.0 'g', 10.0 'g'] Interval[5.0 'g', 10.0 'g'] - + Interval[5.0 'g', 15.0 'g'] Interval[5.0 'g', 15.0 'g'] - + Interval[14.0 'g', 15.0 'g'] Interval[14.0 'g', 15.0 'g'] - + Interval[@2016-05-01T00:00:00.000, @2016-05-02T00:00:00.000] Interval[@2016-05-01T00:00:00.000, @2016-05-02T00:00:00.000] - + Interval[@T00:00:00.000, @T23:59:59.599] Interval[@T00:00:00.000, @T23:59:59.599] - + {Interval[1, 10], Interval[11, 20], Interval[44, 50]} {Interval[1, 10], Interval[11, 20], Interval[44, 50]} - + Interval[5, 3] - + Interval[5, 5) diff --git a/test/spec-tests/xml/CqlListOperatorsTest.xml b/test/spec-tests/xml/CqlListOperatorsTest.xml index 565fc1e8..a6065e97 100644 --- a/test/spec-tests/xml/CqlListOperatorsTest.xml +++ b/test/spec-tests/xml/CqlListOperatorsTest.xml @@ -1,916 +1,916 @@ - - + name="CqlListOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#list-operators-2" version="1.0"> + + ({4, 5, 1, 6, 2, 1}) sL sort asc {1, 1, 2, 4, 5, 6} - + ({4, 5, 1, 6, 2, 1}) sL sort desc {6, 5, 4, 2, 1, 1} - + ({'back', 'aardvark', 'alligator', 'zebra', 'iguana', 'Wolf', 'Armadillo'}) sls sort asc {'Armadillo', 'Wolf', 'aardvark', 'alligator', 'back', 'iguana', 'zebra'} - + ({'back', 'aardvark', 'alligator', 'zebra', 'iguana', 'Wolf', 'Armadillo'}) sls sort desc {'zebra', 'iguana', 'back', 'alligator', 'aardvark', 'Wolf', 'Armadillo'} - + ({ DateTime(2012, 10, 5, 10), DateTime(2012, 1, 1), DateTime(2012, 1, 1, 12), DateTime(2012, 10, 5) }) S sort asc { @2012-01-01T, @2012-01-01T12, @2012-10-05T, @2012-10-05T10 } - + ({ DateTime(2012, 10, 5, 10), DateTime(2012, 1, 1), DateTime(2012, 1, 1, 12), DateTime(2012, 10, 5) }) S sort desc { @2012-10-05T10, @2012-10-05T, @2012-01-01T12, @2012-01-01T } - + { 3, 2, 1 } {3, 2, 1} - + { 3.8, 2.4, 1.9 } {3.8, 2.4, 1.9} - + { 19.99 '[lb_av]', 17.33 '[lb_av]', 10.66 '[lb_av]' } {19.99 '[lb_av]', 17.33 '[lb_av]', 10.66 '[lb_av]'} - + { DateTime(2016), DateTime(2015), DateTime(2010) } {@2016T, @2015T, @2010T} - + { @T15:59:59.999, @T15:12:59.999, @T15:12:13.999 } {@T15:59:59.999, @T15:12:59.999, @T15:12:13.999} - - + + { 'a', 'b', null } contains null true - + { null, 'b', 'c' } contains 'a' false - + { 'a', 'b', 'c' } contains 'a' true - + { DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 1, 1) } contains DateTime(2012, 1, 1) true - + { DateTime(2012, 10, 5), DateTime(2012, 9, 5), DateTime(2012, 10, 1) } contains DateTime(2012, 1, 1) false - + { @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 } contains @T05:59:59.999 true - + { @T15:59:59.999, @T05:59:59.999, @T20:59:59.999 } contains @T08:59:59.999 false - + null contains 'a' false - - + + (null).descendents() null - - + + distinct {} {} - + distinct { null, null, null} { null } - + distinct { 'a', null, 'a', null} {'a', null} - + distinct { 1, 1, 2, 2, 3, 3} {1,2,3} - + distinct { 1, 2, 3, 1, 2, 3} {1,2,3} - + distinct { 'a', 'a', 'b', 'b', 'c', 'c'} {'a','b','c'} - + distinct { 'a', 'b', 'c', 'a', 'b', 'c'} {'a','b','c'} - + distinct { DateTime(2012, 10, 5), DateTime(2012, 1, 1), DateTime(2012, 1, 1)} { @2012-10-05T, @2012-01-01T } - + distinct { @T15:59:59.999, @T20:59:59.999 } { @T15:59:59.999, @T20:59:59.999 } - - + + {null} = {null} true - + {} as List<String> = null null - + null = {} as List<String> null - + {} = {} true - + { 'a', 'b', 'c' } = { 'a', 'b', 'c' } true - + { 'a', 'b', 'c' } = { 'a', 'b' } false - + { 'a', 'b', 'c' } = { 1, 2, 3 } false - + { 1, 2, 3 } = { 'a', 'b', 'c' } false - + { 1, 2, 3 } = { '1', '2', '3' } false - + { 1, 2 } = { 1, 2, 3 } false - + { 1, 2, 3 } = { 1, 2 } false - + { 1, 2, 3 } = { 1, 2, 3 } true - + {DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} = {DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} true - + {DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} = {DateTime(2012, 1, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} false - + { @T15:59:59.999, @T20:59:59.999, @T20:59:59.999 } = { @T15:59:59.999, @T20:59:59.999, @T20:59:59.999 } true - + { @T15:59:59.999, @T20:59:59.999, @T20:59:59.999 } = { @T10:59:59.999, @T20:59:59.999, @T20:59:59.999 } false - - + + {} except {} {} - + { 1, 2, 3, 4 } except { 2, 3 } { 1, 4 } - + { 2, 3 } except { 1, 2, 3, 4 } {} - + { DateTime(2012, 5, 10), DateTime(2014, 12, 10), DateTime(2010, 1, 1)} except {DateTime(2014, 12, 10), DateTime(2010, 1, 1) } {@2012-05-10T} - + { @T15:59:59.999, @T20:59:59.999, @T12:59:59.999 } except { @T20:59:59.999, @T12:59:59.999 } {@T15:59:59.999} - + { 1, 4 } except null {1, 4} - - + + Exists({}) false - + Exists({ null }) false - + Exists({ 1 }) true - + Exists({ 1, 2 }) true - + Exists({ DateTime(2012, 5, 10), DateTime(2014, 12, 10) }) true - + Exists({ @T15:59:59.999, @T20:59:59.999 }) true - + Exists(null) false - - + + Flatten({{},{}}) {} - + Flatten({{null}, {null}}) {null, null} - + Flatten({{1,2}, {3,4}}) {1,2,3,4} - + Flatten({ {DateTime(2012, 5, 10)}, {DateTime(2014, 12, 10)} }) { @2012-05-10T, @2014-12-10T } - + Flatten({ {@T15:59:59.999}, {@T20:59:59.999} }) { @T15:59:59.999, @T20:59:59.999 } - - + + First({}) null - + First({ null, 1 }) null - + First({ 1, null }) 1 - + First({ 1, 2 }) 1 - + First({ DateTime(2012, 5, 10), DateTime(2014, 12, 10) }) @2012-05-10T - + First({ @T15:59:59.999, @T20:59:59.999 }) @T15:59:59.999 - - + + null in {} false - + null in { 1, null } true - + 1 in null false - + 1 in { 1, 2 } true - + 3 in { 1, 2 } false - + DateTime(2012, 5, 10) in { DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10) } true - + DateTime(2012, 6, 10) in { DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10) } false - + @T15:59:59.999 in { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } true - + @T16:59:59.999 in { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } false - - + + {} includes {} true - + {null} includes {null} true - + {1, 2, 3} includes {} true - + {1, 2, 3} includes {2} true - + {1, 2, 3} includes {4} false - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} includes {DateTime(2012, 5, 10)} true - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} includes {DateTime(2012, 5, 11)} false - + { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } includes @T15:59:59.999 true - + { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } includes @T16:59:59.999 false - + null includes {2} null - + {'s', 'a', 'm'} includes null null - - + + {} included in {} true - + { null } included in { null } true - + {} included in { 1, 2, 3 } true - + { 2 } included in { 1, 2, 3 } true - + { 4 } included in { 1, 2, 3 } false - + { DateTime(2012, 5, 10)} included in {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} true - + {DateTime(2012, 5, 11)} included in {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} false - + @T15:59:59.999 included in { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } true - + @T16:59:59.999 included in { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } false - + null included in {2} null - + {'s', 'a', 'm'} included in null null - - + + (null as List<System.Any>)[1] null - + { 1, 2 }[0] 1 - + { 1, 2 }[1] 2 - + { 1, 2 }[2] null - + { 1, 2 }[-1] null - + { DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10) }[1] @2012-05-10T - + { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 }[1] @T15:59:59.999 - - + + IndexOf({}, null) null - + IndexOf(null, {}) null - + IndexOf({ 1, null }, null) null - + IndexOf({ 1, 2 }, 1) 0 - + IndexOf({ 1, 2 }, 2) 1 - + IndexOf({ 1, 2 }, 3) -1 - + IndexOf({ DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10) }, DateTime(2014, 12, 10)) 2 - + IndexOf({ @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 }, @T15:59:59.999) 1 - - + + {} intersect {} {} - + { 1, 2, 3, 4 } intersect { 2, 3 } { 2, 3 } - + {2, 3} intersect { 1, 2, 3, 4 } { 2, 3 } - + { DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10) } intersect { DateTime(2012, 5, 10), DateTime(2014, 12, 10), DateTime(2000, 5, 5) } {@2012-05-10T, @2014-12-10T} - + { @T02:29:15.156, @T15:59:59.999, @T20:59:59.999 } intersect { @T01:29:15.156, @T15:59:59.999, @T20:59:59.999 } {@T15:59:59.999, @T20:59:59.999} - - + + Last({}) null - + Last({null, 1}) 1 - + Last({1, null}) null - + Last({1, 2}) 2 - + Last({DateTime(2012, 5, 10), DateTime(2014, 12, 10)}) @2014-12-10T - + Last({ @T15:59:59.999, @T20:59:59.999 }) @T20:59:59.999 - - + + Length({}) 0 - + Length({null, 1}) 2 - + Length({1, null}) 2 - + Length({1, 2}) 2 - + Length({DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)}) 3 - + Length({ @T15:59:59.999, @T20:59:59.999, @T15:59:59.999, @T20:59:59.999, @T15:59:59.999, @T20:59:59.999 }) 6 - + Length(null as List<Any>) 0 - - + + {} ~ {} true - + { 'a', 'b', 'c' } ~ { 'a', 'b', 'c' } true - + { 'a', 'b', 'c' } ~ { 'a', 'b' } false - + { 'a', 'b', 'c' } ~ { 1, 2, 3 } false - + { 1, 2, 3 } ~ { 'a', 'b', 'c' } false - + { 1, 2, 3 } ~ { '1', '2', '3' } false - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10), null} ~ {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10), null} true - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} ~ {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10), null} false - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} ~ {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 1)} false - + { @T15:59:59.999, @T20:59:59.999 } ~ { @T15:59:59.999, @T20:59:59.999 } true - + { @T15:59:59.999, @T20:59:59.999 } ~ { @T15:59:59.999, @T20:59:59.999, null } false - + { @T15:59:59.999, @T20:59:59.999 } ~ { @T15:59:59.999, @T20:59:59.995 } false - - + + {} != {} false - + { 'a', 'b', 'c' } != { 'a', 'b', 'c' } false - + { 'a', 'b', 'c' } != { 'a', 'b' } true - + { 'a', 'b', 'c' } != { 1, 2, 3 } true - + { 1, 2, 3 } != { 'a', 'b', 'c' } true - + { 1, 2, 3 } != { '1', '2', '3' } true - + {DateTime(2001, 9, 11, 0, 0, 0, 0), DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} != {DateTime(2001, 9, 11, 0, 0, 0, 0), DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 1, 0, 0, 0, 0)} true - + {DateTime(2001, 9, 11, 0, 0, 0, 0), DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} != {DateTime(2001, 9, 11, 0, 0, 0, 0), DateTime(2012, 5, 10, 0, 0, 0, 0), DateTime(2014, 12, 10, 0, 0, 0, 0)} false - + { @T15:59:59.999, @T20:59:59.999 } = { @T15:59:59.999, @T20:59:59.999 } true - + { @T15:59:59.999, @T20:59:59.999 } = { @T15:59:59.999, @T20:59:49.999 } false - - + + {'s', 'u', 'n'} properly includes null false - + {'s', 'u', 'n', null} properly includes null true - + { @T15:59:59, @T20:59:59.999, @T20:59:49.999 } properly includes @T15:59:59 true - + { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } properly includes @T15:59:59 null - - + + null properly included in {'s', 'u', 'n'} false - + null properly included in {'s', 'u', 'n', null} true - + @T15:59:59 properly included in { @T15:59:59, @T20:59:59.999, @T20:59:49.999 } true - + @T15:59:59 properly included in { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } null - - + + {} properly includes {} false - + {null} properly includes {null} false - + {1, 2, 3} properly includes {} true - + {1, 2, 3} properly includes {2} true - + {1, 2, 3} properly includes {4} false - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} properly includes {DateTime(2012, 5, 10), DateTime(2014, 12, 10)} true - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} properly includes {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} false - + { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } properly includes { @T15:59:59.999, @T20:59:59.999 } true - + { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } properly includes { @T15:59:59.999, @T20:59:59.999, @T14:59:22.999 } false - + null properly includes {2} null - - + + {} properly included in {} false - + {null} properly included in {null} false - + {} properly included in {1, 2, 3} true - + {2} properly included in {1, 2, 3} true - + {4} properly included in {1, 2, 3} false - + {DateTime(2012, 5, 10), DateTime(2014, 12, 10)} properly included in {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} true - + {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} properly included in {DateTime(2001, 9, 11), DateTime(2012, 5, 10), DateTime(2014, 12, 10)} false - + { @T15:59:59.999, @T20:59:59.999 } properly included in { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } true - + { @T15:59:59.999, @T20:59:59.999, @T14:59:22.999 } properly included in { @T15:59:59.999, @T20:59:59.999, @T20:59:49.999 } false - + {'s', 'u', 'n'} properly included in null null - - + + singleton from {} null - + singleton from {null} null - + singleton from { 1 } 1 - + singleton from { 1, 2 } - + singleton from { DateTime(2012, 5, 10) } @2012-05-10T - + singleton from { @T15:59:59.999 } @T15:59:59.999 - - + + Skip(null, 3) null - + Skip({1,2,3,4,5}, 2) {3, 4, 5} - + Skip({1,2,3,4,5}, 3) {4, 5} - + Skip({1,2,3,4,5}, 0) {1,2,3,4,5} - + Skip({1,2,3,4,5}, 5) {} - - + + Tail(null) null - + Tail({1,2,3,4}) {2,3,4} - + Tail({1,2,3,4,5}) {2,3,4,5} - + Tail({}) {} - + Tail({1}) {} - + Take(null, 3) null - + Take({1,2,3}, null as Integer) {} - + Take({1,2,3}, 0) {} - + Take({1,2,3,4}, 2) {1, 2} - + Take({1,2,3,4}, 3) {1, 2, 3} - + Take({1,2,3,4}, 4) {1, 2, 3, 4} - - + + {} union {} {} - + { null } union { null } {null} - + { 1, 2, 3 } union {} {1, 2, 3} - + { 1, 2, 3 } union { 2 } {1, 2, 3} - + { 1, 2, 3 } union { 4 } {1, 2, 3, 4} - + { DateTime(2001, 9, 11)} union {DateTime(2012, 5, 10), DateTime(2014, 12, 10) } {@2001-09-11T, @2012-05-10T, @2014-12-10T} - + { @T15:59:59.999, @T20:59:59.999, @T12:59:59.999 } union { @T10:59:59.999 } {@T15:59:59.999, @T20:59:59.999, @T12:59:59.999, @T10:59:59.999} diff --git a/test/spec-tests/xml/CqlLogicalOperatorsTest.xml b/test/spec-tests/xml/CqlLogicalOperatorsTest.xml index dd1446eb..36062aa6 100644 --- a/test/spec-tests/xml/CqlLogicalOperatorsTest.xml +++ b/test/spec-tests/xml/CqlLogicalOperatorsTest.xml @@ -1,169 +1,169 @@ - - + name="CqlLogicalOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#logical-operators-3" version="1.0"> + + true and true true - + true and false false - + true and null null - + false and true false - + false and false false - + false and null false - + null and true null - + null and false false - + null and null null - + - + true implies true true - + true implies false false - + true implies null null - + false implies true true - + false implies false true - + false implies null true - + null implies true true - + null implies false null - + null implies null null - - + + not true false - + not false true - + not null null - - + + true or true true - + true or false true - + true or null true - + false or true true - + false or false false - + false or null null - + null or true true - + null or false null - + null or null null - - + + true xor true false - + true xor false true - + true xor null null - + false xor true true - + false xor false false - + false xor null null - + null xor true null - + null xor false null - + null xor null null diff --git a/test/spec-tests/xml/CqlNullologicalOperatorsTest.xml b/test/spec-tests/xml/CqlNullologicalOperatorsTest.xml index 85c89055..5af5c10d 100644 --- a/test/spec-tests/xml/CqlNullologicalOperatorsTest.xml +++ b/test/spec-tests/xml/CqlNullologicalOperatorsTest.xml @@ -1,98 +1,98 @@ - - + name="CqlNullologicalOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#nullological-operators-3" version="1.0"> + + Coalesce('a', null) 'a' - + Coalesce(null, 'a') 'a' - + Coalesce({}) null - + Coalesce({'a', null, null}) 'a' - + Coalesce({null, null, 'a'}) 'a' - + Coalesce({'a'},null, null) {'a'} - + Coalesce(null, null, {'a'}) {'a'} - + Coalesce(null, null, DateTime(2012, 5, 18)) @2012-05-18T - + Coalesce({ null, null, DateTime(2012, 5, 18) }) @2012-05-18T - + Coalesce(null, null, @T05:15:33.556) @T05:15:33.556 - + Coalesce({ null, null, @T05:15:33.556 }) @T05:15:33.556 - - + + IsNull(null) true - + IsNull('') false - + IsNull('abc') false - + IsNull(1) false - + IsNull(0) false - - + + IsFalse(false) true - + IsFalse(true) false - + IsFalse(null) false - - + + IsTrue(true) true - + IsTrue(false) false - + IsTrue(null) false diff --git a/test/spec-tests/xml/CqlQueryTests.xml b/test/spec-tests/xml/CqlQueryTests.xml index b1354fa5..43e738ea 100644 --- a/test/spec-tests/xml/CqlQueryTests.xml +++ b/test/spec-tests/xml/CqlQueryTests.xml @@ -1,56 +1,56 @@ - - + xmlns="http://hl7.org/fhirpath/tests" xsi:schemaLocation="http://hl7.org/fhirpath/tests ../../testSchema/testSchema.xsd" name="CqlQueryTest" reference="https://cql.hl7.org/02-authorsguide.html#queries" version="1.0"> + + (4) l 4 - + (4) l return 'Hello World' 'Hello World' - + from ({2, 3}) A, ({5, 6}) B {{ A: 2, B: 5 }, { A: 2, B: 6 }, { A: 3, B: 5 }, { A: 3, B: 6 }} - - + + ({1, 2, 3}) l sort desc {3, 2, 1} - + ({1, 3, 2}) l sort ascending {1, 2, 3} - + ({@2013-01-02T00:00:00.000Z, @2014-01-02T00:00:00.000Z, @2015-01-02T00:00:00.000Z}) l sort desc {@2015-01-02T00:00:00.000Z, @2014-01-02T00:00:00.000Z, @2013-01-02T00:00:00.000Z} - + ({@2013-01-02T00:00:00.000Z, @2015-01-02T00:00:00.000Z, @2014-01-02T00:00:00.000Z}) l sort ascending {@2013-01-02T00:00:00.000Z, @2014-01-02T00:00:00.000Z, @2015-01-02T00:00:00.000Z} - - + + ({1, 2, 3, 3, 4}) L aggregate A starting 1: A * L 72 - + ({1, 2, 3, 3, 4}) L aggregate all A starting 1: A * L 72 - + ({1, 2, 3, 3, 4}) L aggregate distinct A starting 1: A * L 24 - + ({1, 2, 3}) L aggregate A : A * L null - + from ({1, 2, 3}) B, (4) C aggregate A : A + B + C null diff --git a/test/spec-tests/xml/CqlStringOperatorsTest.xml b/test/spec-tests/xml/CqlStringOperatorsTest.xml index f9edbe9b..007789f9 100644 --- a/test/spec-tests/xml/CqlStringOperatorsTest.xml +++ b/test/spec-tests/xml/CqlStringOperatorsTest.xml @@ -1,359 +1,359 @@ - - + name="CqlStringOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#string-operators-3" version="1.0"> + + Combine(null) null - + Combine({}) null - + Combine({'a', 'b', 'c'}) 'abc' - + Combine({'a', 'b', 'c'}, '-') 'a-b-c' - - + + Concatenate(null, null) null - + Concatenate('a', null) null - + Concatenate(null, 'b') null - + Concatenate('a', 'b') 'ab' - + 'a' + 'b' 'ab' - - + + EndsWith(null, null) null - + EndsWith('Chris Schuler is the man!!', 'n!!') true - + EndsWith('Chris Schuler is the man!!', 'n!') false - - + + Indexer(null as String, null) null - + Indexer('a', null) null - + Indexer(null as String, 1) null - + Indexer('ab', 0) 'a' - + Indexer('ab', 1) 'b' - + Indexer('ab', 2) null - + Indexer('ab', -1) null - - + + LastPositionOf(null, null) null - + LastPositionOf(null, 'hi') null - + LastPositionOf('hi', null) null - + LastPositionOf('hi', 'Ohio is the place to be!') 1 - + LastPositionOf('hi', 'Say hi to Ohio!') 11 - - + + Length(null as String) null - + Length('') 0 - + Length('a') 1 - + Length('ab') 2 - - + + Lower(null) null - + Lower('') '' - + Lower('A') 'a' - + Lower('b') 'b' - + Lower('Ab') 'ab' - - + + Matches('Not all who wander are lost', null) null - + Matches('Not all who wander are lost', '.*\\d+') false - + Matches('Not all who wander are lost - circa 2017', '.*\\d+') true - + Matches('Not all who wander are lost', '.*') true - + Matches('Not all who wander are lost', '[\\w|\\s]+') true - + Matches('Not all who wander are lost - circa 2017', '^[\\w\\s]+$') false - + Matches(' ', '\\W+') true - + Matches(' \n\t', '\\s+') true - - + + PositionOf(null, null) null - + PositionOf('a', null) null - + PositionOf(null, 'a') null - + PositionOf('a', 'ab') 0 - + PositionOf('b', 'ab') 1 - + PositionOf('c', 'ab') -1 - - + + ReplaceMatches('Not all who wander are lost', null, 'But I am...') null - + ReplaceMatches('Not all who wander are lost', 'Not all who wander are lost', 'But still waters run deep') 'But still waters run deep' - + ReplaceMatches('Who put the bop in the bop she bop she bop?', 'bop', 'bang') 'Who put the bang in the bang she bang she bang?' - + ReplaceMatches('All that glitters is not gold', '\\s', '\\$') 'All$that$glitters$is$not$gold' - - + + Split(null, null) null - + Split(null, ',') null - + Split('a,b', null) {'a,b'} - + Split('a,b', '-') {'a,b'} - + Split('a,b', ',') {'a','b'} - - + + StartsWith(null, null) null - + StartsWith('hi', null) null - + StartsWith(null, 'hi') null - + StartsWith('Breathe deep the gathering gloom', 'Bre') true - + StartsWith('Breathe deep the gathering gloom', 'bre') false - - + + Substring(null, null) null - + Substring('a', null) null - + Substring(null, 1) null - + Substring('ab', 0) 'ab' - + Substring('ab', 1) 'b' - + Substring('ab', 2) null - + Substring('ab', -1) null - + Substring('ab', 0, 1) 'a' - + Substring('abc', 1, 1) 'b' - + Substring('ab', 0, 3) 'ab' - - + + Upper(null) null - + Upper('') '' - + Upper('a') 'A' - + Upper('B') 'B' - + Upper('aB') 'AB' - - + + ToString(125 'cm') '125 \'cm\'' - + ToString(DateTime(2000, 1, 1)) '2000-01-01' - + ToString(DateTime(2000, 1, 1, 15, 25, 25, 300)) '2000-01-01T15:25:25.300' - + ToString(DateTime(2000, 1, 1, 8, 25, 25, 300, -7)) '2000-01-01T08:25:25.300-07:00' - + ToString(@T09:30:01.003) '09:30:01.003' diff --git a/test/spec-tests/xml/CqlTypeOperatorsTest.xml b/test/spec-tests/xml/CqlTypeOperatorsTest.xml index c26df224..e5f1d91a 100644 --- a/test/spec-tests/xml/CqlTypeOperatorsTest.xml +++ b/test/spec-tests/xml/CqlTypeOperatorsTest.xml @@ -1,69 +1,69 @@ - - + name="CqlTypeOperatorsTest" reference="https://cql.hl7.org/09-b-cqlreference.html#type-operators-1" version="1.0"> + + 45.5 'g' as Quantity 45.5 'g' - + cast 45.5 'g' as Quantity 45.5 'g' - + DateTime(2014, 01, 01) as DateTime @2014-01-01T - - + + convert 5 to Decimal 5.0 - + convert 5 to String '5' - + convert 'foo' to Integer null - + convert '2014-01-01' to DateTime @2014-01-01T - + convert 'T14:30:00.0' to Time @T14:30:00.000 - + convert '2014/01/01' to DateTime null - - + + 5 is Integer true - + '5' is Integer false - + System.ValueSet{id: '123'} is Vocabulary true This should return true because ValueSet is derived from Vocabulary. - - + + ToBoolean('NO') false - - + + ToConcept(Code { code: '8480-6' }) Concept { @@ -72,98 +72,98 @@ - - + + ToDateTime('2014-01-01') @2014-01-01T - + ToDateTime('2014-01-01T12:05') @2014-01-01T12:05 - + ToDateTime('2014-01-01T12:05:05.955') @2014-01-01T12:05:05.955 - + ToDateTime('2014-01-01T12:05:05.955+01:30') @2014-01-01T12:05:05.955+01:30 - + ToDateTime('2014-01-01T12:05:05.955-01:15') @2014-01-01T12:05:05.955-01:15 - + ToDateTime('2014-01-01T12:05:05.955Z') @2014-01-01T12:05:05.955+00:00 - + ToDateTime('2014/01/01T12:05:05.955Z') null - + ToDateTime(@2014-01-01) @2014-01-01T - + hour from ToDateTime(@2014-01-01) is null true - - + + ToDecimal('+25.5') 25.5 - - + + ToInteger('-25') -25 - - + + ToQuantity('5.5 \'cm\'') 5.5'cm' - - + + ToString(-5) '-5' - + ToString(18.55) '18.55' - + ToString(5.5 'cm') '5.5 \'cm\'' - + ToString(true) 'true' - - + + ToTime('T14:30:00.0') @T14:30:00.000 - + ToTime('T14:30:00.0+05:30') @T14:30:00.000 - + ToTime('T14:30:00.0-05:45') @T14:30:00.000 - + ToTime('T14:30:00.0Z') @T14:30:00.000 - + ToTime('T14-30-00.0') null diff --git a/test/spec-tests/xml/CqlTypesTest.xml b/test/spec-tests/xml/CqlTypesTest.xml index 3ad64796..639776ae 100644 --- a/test/spec-tests/xml/CqlTypesTest.xml +++ b/test/spec-tests/xml/CqlTypesTest.xml @@ -1,9 +1,9 @@ + name="CqlTypesTest" reference="https://cql.hl7.org/09-b-cqlreference.html#types-2" version="1.0"> - + - + 5.0 'g' 5.0'g' - + DateTime(2012, 4, 4) @2012-04-04T - + @T09:00:00.000 @T09:00:00.000 - + Interval[2, 7] Interval[2, 7] - + {1, 2, 3} {1, 2, 3} - + Tuple { id: 5, name: 'Chris'} Tuple { id: 5, name: 'Chris'} - + Tuple { id: 5, name: 'Chris'}.name 'Chris' - + - - + + DateTime(null) null - + DateTime(10000, 12, 31, 23, 59, 59, 999) - + DateTime(0000, 1, 1, 0, 0, 0, 0) - + DateTime(2016, 7, 7, 6, 25, 33, 910) @2016-07-07T06:25:33.910 - + DateTime(2015, 2, 10) @2015-02-10T - + days between DateTime(2015, 2, 10) and DateTime(2015, 3) Interval [ 18, 49 ] - + DateTime(0001, 1, 1, 0, 0, 0, 0) @0001-01-01T00:00:00.000 - + DateTime(9999, 12, 31, 23, 59, 59, 999) @9999-12-31T23:59:59.999 - + hour from @2015-02-10T is null true - + - + - + - - + + 150.2 '[lb_av]' 150.2 '[lb_av]' - + 2.5589 '{eskimo kisses}' 2.5589 '{eskimo kisses}' - + 5.999999999 'g' 5.999999999 'g' - - + + '\'I start with a single quote and end with a double quote\"' '\u0027I start with a single quote and end with a double quote\u0022' - + '\u0048\u0069' 'Hi' - - + + @T24:59:59.999 - + @T23:60:59.999 - + @T23:59:60.999 - + @T23:59:59.10000 - + @T10:25:12.863 @T10:25:12.863 - + @T23:59:59.999 @T23:59:59.999 - + @T00:00:00.000 @T00:00:00.000 diff --git a/test/spec-tests/xml/ValueLiteralsAndSelectors.xml b/test/spec-tests/xml/ValueLiteralsAndSelectors.xml index 1fc5524d..35dd55f8 100644 --- a/test/spec-tests/xml/ValueLiteralsAndSelectors.xml +++ b/test/spec-tests/xml/ValueLiteralsAndSelectors.xml @@ -1,10 +1,10 @@ + name="ValueLiteralsAndSelectors" reference="https://cql.hl7.org/03-developersguide.html#literals" version="1.0"> - - + + null null @@ -13,12 +13,12 @@ Boolean - The boolean literals (true and false) --> - - + + false false - + true true @@ -27,93 +27,93 @@ Integer - Sequences of digits in the range 0..2^32-1 --> - - + + 0 0 - + +0 0 - + -0 0 - + 1 1 - + +1 1 - + -1 -1 - + 2 2 - + +2 2 - + -2 -2 - + Power(10,9) 1000000000 - + +Power(10,9) 1000000000 - + -Power(10,9) -1000000000 - + Power(2,30)-1+Power(2,30) 2147483647 - + +Power(2,30)-1+Power(2,30) 2147483647 - + -Power(2,30)+1-Power(2,30) -2147483647 - + 2147483648 - + +2147483648 - + -Power(2,30)-Power(2,30) -2147483648 - + 2147483649 - + +2147483649 - + -2147483649 @@ -123,180 +123,180 @@ Decimal - Sequences of digits with a decimal point, in the range 0.0.. 10^28 –10^-8 --> - - + + 0.0 0.0 - + +0.0 0.0 - + -0.0 0.0 - + 1.0 1.0 - + +1.0 1.0 - + -1.0 -1.0 - + 2.0 2.0 - + +2.0 2.0 - + -2.0 -2.0 - + Power(10.0,9.0) 1000000000.0 - + +Power(10.0,9.0) 1000000000.0 - + -Power(10.0,9.0) -1000000000.0 - + Power(2.0,30.0)-1+Power(2.0,30.0) 2147483647.0 - + +Power(2.0,30.0)-1+Power(2.0,30.0) 2147483647.0 - + -Power(2.0,30.0)+1.0-Power(2.0,30.0) -2147483647.0 - + Power(2.0,30.0)+Power(2.0,30.0) 2147483648.0 - + +Power(2.0,30.0)+Power(2.0,30.0) 2147483648.0 - + -Power(2.0,30.0)-Power(2.0,30.0) -2147483648.0 - + Power(2.0,30.0)+1.0+Power(2.0,30.0) 2147483649.0 - + +Power(2.0,30.0)+1.0+Power(2.0,30.0) 2147483649.0 - + -Power(2.0,30.0)-1.0-Power(2.0,30.0) -2147483649.0 - + 0.00000000 0.00000000 - + +0.00000000 0.00000000 - + -0.00000000 0.00000000 - + Power(10,-8) 0.00000001 - + +Power(10,-8) 0.00000001 - + -Power(10,-8) -0.00000001 - + 2.0*Power(10,-8) 0.00000002 - + +2.0*Power(10,-8) 0.00000002 - + -2.0*Power(10,-8) -0.00000002 - + Power(10,-7) 0.0000001 - + +Power(10,-7) 0.0000001 - + -Power(10,-7) -0.0000001 - + 0.000000001 - + +0.000000001 - + -0.000000001 - + 10*1000000000000000000000000000.00000000-0.00000001 9999999999999999999999999999.99999999 - + +10*1000000000000000000000000000.00000000-0.00000001 9999999999999999999999999999.99999999 - + -10*1000000000000000000000000000.00000000+0.00000001 -9999999999999999999999999999.99999999 - + 10000000000000000000000000000.00000000 - + +10000000000000000000000000000.00000000 - + -10000000000000000000000000000.00000000 @@ -306,7 +306,7 @@ String - Strings of any character enclosed within single-ticks (') --> - + @@ -314,7 +314,7 @@ DateTime - The at-symbol (@) followed by an ISO-8601 compliant representation of a date/time --> - + @@ -322,31 +322,31 @@ Time - The at-symbol (@) followed by an ISO-8601 compliant representation of a time --> - + - + - + - + - + - + - + - +