summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_range.yaml
diff options
context:
space:
mode:
authorJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
committerJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
commit735c78d3ecb695dd16cb37879880f522c4b29c72 (patch)
tree8bfb2ecbd0f03730efa1540cc65d8490b67e8ddd /tests/files/fail/test_range.yaml
Import upstream version 1.7.0
Diffstat (limited to 'tests/files/fail/test_range.yaml')
-rw-r--r--tests/files/fail/test_range.yaml219
1 files changed, 219 insertions, 0 deletions
diff --git a/tests/files/fail/test_range.yaml b/tests/files/fail/test_range.yaml
new file mode 100644
index 0000000..22bd801
--- /dev/null
+++ b/tests/files/fail/test_range.yaml
@@ -0,0 +1,219 @@
+---
+name: fail-range-1
+desc:
+data:
+ - foo
+ - bar
+ - foobar
+schema:
+ type: seq
+ sequence:
+ - type: str
+ range:
+ max: 5
+ min: 1
+errors:
+ - "Type 'scalar' has size of '6', greater than max limit '5'. Path: '/2'"
+---
+name: fail-range-2
+desc: Test that range validates on 'map' raise correct error
+data:
+ streams:
+ sampleRateMultiple: 1
+schema:
+ type: map
+ mapping:
+ streams:
+ type: map
+ range:
+ min: 2
+ max: 3
+ mapping:
+ sampleRateMultiple:
+ type: int
+ required: True
+errors:
+ - "Type 'map' has size of '1', less than min limit '2'. Path: '/streams'"
+---
+name: fail-range-3
+desc: Test that range validates on 'seq' raise correct error
+data:
+ - foobar
+ - barfoo
+ - opa
+schema:
+ type: seq
+ range:
+ min: 1
+ max: 2
+ sequence:
+ - type: str
+errors:
+ - "Type 'seq' has size of '3', greater than max limit '2'. Path: ''"
+---
+name: fail-range-4
+desc: Test float range value out of range
+data:
+ the_float: 1.2
+ the_float_ex: 2.1
+schema:
+ type: map
+ mapping:
+ the_float:
+ type: float
+ required: True
+ range:
+ min: 2.1
+ max: 3.2
+ the_float_ex:
+ type: float
+ required: True
+ range:
+ min-ex: 2.1
+ max-ex: 3.2
+errors:
+ - "Type 'scalar' has size of '1.2', less than min limit '2.1'. Path: '/the_float'"
+ - "Type 'scalar' has size of '2.1', less than or equals to min limit(exclusive) '2.1'. Path: '/the_float_ex'"
+---
+name: fail-range-1
+desc: range test && bug#?????
+schema:
+ type: map
+ mapping:
+ "max-only":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {max: 100}
+ "min-only":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {min: 10.0}
+ "max-and-min":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {max: 100.0, min: 10.0}
+data:
+ max-only:
+ - 101
+ - 100.1
+ min-only:
+ - 9
+ - 9.99
+ max-and-min:
+ - 101
+ - 100.1
+ - 9
+ - 9.99
+errors:
+ - "Type 'scalar' has size of '100.1', greater than max limit '100'. Path: '/max-only/1'"
+ - "Type 'scalar' has size of '100.1', greater than max limit '100.0'. Path: '/max-and-min/1'"
+ - "Type 'scalar' has size of '101', greater than max limit '100'. Path: '/max-only/0'"
+ - "Type 'scalar' has size of '101', greater than max limit '100.0'. Path: '/max-and-min/0'"
+ - "Type 'scalar' has size of '9', less than min limit '10.0'. Path: '/max-and-min/2'"
+ - "Type 'scalar' has size of '9', less than min limit '10.0'. Path: '/min-only/0'"
+ - "Type 'scalar' has size of '9.99', less than min limit '10.0'. Path: '/max-and-min/3'"
+ - "Type 'scalar' has size of '9.99', less than min limit '10.0'. Path: '/min-only/1'"
+ ## Kwalify errors
+ # :range_toolarge : 2:3:[/max-only/0] '101': too large (> max 100).
+ # :range_toolarge : 3:3:[/max-only/1] '100.1': too large (> max 100).
+ # :range_toosmall : 5:3:[/min-only/0] '9': too small (< min 10.0).
+ # :range_toosmall : 6:3:[/min-only/1] '9.99': too small (< min 10.0).
+ # :range_toolarge : 8:3:[/max-and-min/0] '101': too large (> max 100.0).
+ # :range_toolarge : 9:3:[/max-and-min/1] '100.1': too large (> max 100.0).
+ # :range_toosmall : 10:3:[/max-and-min/2] '9': too small (< min 10.0).
+ # :range_toosmall : 11:3:[/max-and-min/3] '9.99': too small (< min 10.0).
+---
+name: fail-range-2
+desc: range test (with max-ex and min-ex)
+schema:
+ type: map
+ mapping:
+ "max-ex-only":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {max-ex: 100}
+ "min-ex-only":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {min-ex: 10.0}
+ "max-ex-and-min-ex":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {max-ex: 100.0, min-ex: 10.0}
+data:
+ max-ex-only:
+ - 100
+ - 100.0
+ min-ex-only:
+ - 10
+ - 10.0
+ max-ex-and-min-ex:
+ - 100
+ - 100.0
+ - 10
+ - 10.0
+errors:
+ - "Type 'scalar' has size of '10', less than or equals to min limit(exclusive) '10.0'. Path: '/max-ex-and-min-ex/2'"
+ - "Type 'scalar' has size of '10', less than or equals to min limit(exclusive) '10.0'. Path: '/min-ex-only/0'"
+ - "Type 'scalar' has size of '10.0', less than or equals to min limit(exclusive) '10.0'. Path: '/max-ex-and-min-ex/3'"
+ - "Type 'scalar' has size of '10.0', less than or equals to min limit(exclusive) '10.0'. Path: '/min-ex-only/1'"
+ - "Type 'scalar' has size of '100', greater than or equals to max limit(exclusive) '100'. Path: '/max-ex-only/0'"
+ - "Type 'scalar' has size of '100', greater than or equals to max limit(exclusive) '100.0'. Path: '/max-ex-and-min-ex/0'"
+ - "Type 'scalar' has size of '100.0', greater than or equals to max limit(exclusive) '100'. Path: '/max-ex-only/1'"
+ - "Type 'scalar' has size of '100.0', greater than or equals to max limit(exclusive) '100.0'. Path: '/max-ex-and-min-ex/1'"
+ ## Kwalify errors
+ # :range_toolargeex : 2:3:[/max-ex-only/0] '100': too large (>= max 100).
+ # :range_toolargeex : 3:3:[/max-ex-only/1] '100.0': too large (>= max 100).
+ # :range_toosmallex : 5:3:[/min-ex-only/0] '10': too small (<= min 10.0).
+ # :range_toosmallex : 6:3:[/min-ex-only/1] '10.0': too small (<= min 10.0).
+ # :range_toolargeex : 8:3:[/max-ex-and-min-ex/0] '100': too large (>= max 100.0).
+ # :range_toolargeex : 9:3:[/max-ex-and-min-ex/1] '100.0': too large (>= max 100.0).
+ # :range_toosmallex : 10:3:[/max-ex-and-min-ex/2] '10': too small (<= min 10.0).
+ # :range_toosmallex : 11:3:[/max-ex-and-min-ex/3] '10.0': too small (<= min 10.0).
+---
+name: fail-range-3
+desc: range test (with max, min, max-ex and min-ex)
+schema:
+ type: map
+ mapping:
+ "A":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {max: 100, min-ex: 10.0}
+ "B":
+ type: seq
+ sequence:
+ - type: number
+ required: true
+ range: {min: 10, max-ex: 100.0}
+data:
+ A:
+ - 100.00001
+ - 10.0
+ B:
+ - 9.99999
+ - 100.0
+errors:
+ - "Type 'scalar' has size of '10.0', less than or equals to min limit(exclusive) '10.0'. Path: '/A/1'"
+ - "Type 'scalar' has size of '100.0', greater than or equals to max limit(exclusive) '100.0'. Path: '/B/1'"
+ - "Type 'scalar' has size of '100.00001', greater than max limit '100'. Path: '/A/0'"
+ - "Type 'scalar' has size of '9.99999', less than min limit '10'. Path: '/B/0'"
+ ## Kwalify errors
+ # :range_toolarge : 2:3:[/A/0] '100.00001': too large (> max 100)"
+ # :range_toosmallex : 3:3:[/A/1] '10.0': too small (<= min 10.0).
+ # :range_toosmall : 5:3:[/B/0] '9.99999': too small (< min 10).
+ # :range_toolargeex : 6:3:[/B/1] '100.0': too large (>= max 100.0).