From 3408b0f4667a912bd527dd07b1865cf79317b627 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 12 Oct 2023 18:45:21 -0400 Subject: [PATCH 1/3] SCHEMA: Make expression tests more manageable --- src/schema/meta/expression_tests.yaml | 56 +++++++-------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/src/schema/meta/expression_tests.yaml b/src/schema/meta/expression_tests.yaml index 4d8c63f008..1fc59ac589 100644 --- a/src/schema/meta/expression_tests.yaml +++ b/src/schema/meta/expression_tests.yaml @@ -1,55 +1,35 @@ --- # null fall-through logic -- expression: sidecar.MissingValue - result: null -- expression: null.anything - result: null +- expression: sidecar.MissingValue != true + result: true +- expression: null.anything != true + result: true - expression: (null) result: null -- expression: null[0] - result: null +- expression: null[0] != true + result: true - expression: null && true result: null -- expression: null || true - result: null - expression: true && null result: null - expression: false && null result: false - expression: true || null result: true +- expression: null || true + result: true - expression: false || null result: null - expression: '!null' - result: null -- expression: null + 1 - result: null -- expression: null - 1 - result: null -- expression: null * 1 - result: null -- expression: null / 1 - result: null -- expression: 1 + null - result: null -- expression: 1 - null - result: null -- expression: 1 * null - result: null -- expression: 1 / null - result: null -- expression: "'str1' + null" - result: null -- expression: "null + 'str1'" - result: null + result: true - expression: intersects([], null) - result: null + result: false - expression: intersects(null, []) - result: null + result: false - expression: match(null, 'pattern') - result: null + result: false - expression: match('string', null) - result: null + result: false - expression: substr(null, 1, 4) result: null - expression: substr('string', null, 4) @@ -85,21 +65,11 @@ - expression: exists([], null) result: false -# Truth/falsity of final expressions -- expression: evaluate(true) - result: true -- expression: evaluate(false) - result: false -- expression: evaluate(null) - result: false - # General expressions - expression: 1 + 2 result: 3 - expression: '"cat" + "dog"' result: 'catdog' -- expression: '1 + "cat"' - result: null - expression: match('string', '.*') result: true - expression: match('', '.') From 7a2d35d5d54686bcaa1590a0088f8948bc12cbe6 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 12 Oct 2023 19:12:26 -0400 Subject: [PATCH 2/3] FIX: exists() return type is int --- src/schema/meta/expression_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schema/meta/expression_tests.yaml b/src/schema/meta/expression_tests.yaml index 1fc59ac589..3df5a8610e 100644 --- a/src/schema/meta/expression_tests.yaml +++ b/src/schema/meta/expression_tests.yaml @@ -61,9 +61,9 @@ - expression: '"VolumeTiming" in null' result: false - expression: exists(null, "bids-uri") - result: false + result: 0 - expression: exists([], null) - result: false + result: 0 # General expressions - expression: 1 + 2 From ff19470e1b909d72aab4cf817f395a6f96fa1868 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 19 Oct 2023 15:19:07 -0400 Subject: [PATCH 3/3] FIX: Expressions again --- src/schema/meta/expression_tests.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/schema/meta/expression_tests.yaml b/src/schema/meta/expression_tests.yaml index 3df5a8610e..e1f06fdedc 100644 --- a/src/schema/meta/expression_tests.yaml +++ b/src/schema/meta/expression_tests.yaml @@ -1,13 +1,13 @@ --- # null fall-through logic -- expression: sidecar.MissingValue != true - result: true -- expression: null.anything != true - result: true +- expression: sidecar.MissingValue + result: null +- expression: null.anything + result: null - expression: (null) result: null -- expression: null[0] != true - result: true +- expression: null[0] + result: null - expression: null && true result: null - expression: true && null @@ -27,7 +27,7 @@ - expression: intersects(null, []) result: false - expression: match(null, 'pattern') - result: false + result: null - expression: match('string', null) result: false - expression: substr(null, 1, 4) @@ -59,11 +59,13 @@ - expression: null == 1 result: false - expression: '"VolumeTiming" in null' - result: false + result: null - expression: exists(null, "bids-uri") result: 0 - expression: exists([], null) result: 0 +- expression: true || sidecar.MissingValue + result: true # General expressions - expression: 1 + 2