summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_range.yaml
blob: 22bd80198b04365e72ef0fb49be6435960571c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
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).