Skip to content

Commit

Permalink
SCHEMA: Make expression tests more manageable (#1629)
Browse files Browse the repository at this point in the history
* SCHEMA: Make expression tests more manageable

* FIX: exists() return type is int

* FIX: Expressions again
  • Loading branch information
effigies authored Oct 19, 2023
1 parent 0dcb141 commit 7c33569
Showing 1 changed file with 10 additions and 38 deletions.
48 changes: 10 additions & 38 deletions src/schema/meta/expression_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,26 @@
result: null
- 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
- expression: match('string', null)
result: null
result: false
- expression: substr(null, 1, 4)
result: null
- expression: substr('string', null, 4)
Expand Down Expand Up @@ -79,27 +59,19 @@
- expression: null == 1
result: false
- expression: '"VolumeTiming" in null'
result: false
result: null
- expression: exists(null, "bids-uri")
result: false
result: 0
- expression: exists([], null)
result: false

# Truth/falsity of final expressions
- expression: evaluate(true)
result: 0
- expression: true || sidecar.MissingValue
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('', '.')
Expand Down

0 comments on commit 7c33569

Please sign in to comment.