-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formats_err: add tests for precompile checks of
valid
- Loading branch information
1 parent
c911e0a
commit e15e350
Showing
15 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/2: | ||
# error: can't compare Int1Type(false) and CalcBooleanType | ||
# | ||
meta: | ||
id: attr_bad_valid_any_of | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
any-of: | ||
- 0 | ||
- 1 | ||
- true | ||
- 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# attr_bad_valid_eq_long.ksy: /seq/0/valid/eq: | ||
# error: can't compare Int1Type(false) and CalcStrType | ||
# | ||
meta: | ||
id: attr_bad_valid_eq_long | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
eq: '"bar"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# attr_bad_valid_eq_short.ksy: /seq/0/valid: | ||
# error: can't compare Int1Type(false) and CalcStrType | ||
# | ||
meta: | ||
id: attr_bad_valid_eq_short | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: '"bar"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# attr_bad_valid_expr.ksy: /seq/0/valid/expr: | ||
# error: invalid type: expected boolean, got Int1Type(true) | ||
# | ||
meta: | ||
id: attr_bad_valid_expr | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
expr: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# attr_bad_valid_in_enum_false.ksy: /seq/0/valid/in-enum: | ||
# error: only `true` is supported as value, got `false` (if you don't want any validation, omit the `valid` key) | ||
# | ||
meta: | ||
id: attr_bad_valid_in_enum_false | ||
seq: | ||
- id: foo | ||
type: u1 | ||
enum: animal | ||
valid: | ||
in-enum: false | ||
enums: | ||
animal: | ||
1: cat | ||
2: dog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# attr_bad_valid_in_enum_no_enum.ksy: /seq/0/valid/in-enum: | ||
# error: `valid/in-enum` requires the `enum` key | ||
# | ||
meta: | ||
id: attr_bad_valid_in_enum_no_enum | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
in-enum: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# attr_bad_valid_range.ksy: /seq/0/valid/min: | ||
# error: can't compare Int1Type(false) and CalcBooleanType | ||
# | ||
# attr_bad_valid_range.ksy: /seq/0/valid/max: | ||
# error: can't compare Int1Type(false) and CalcStrType | ||
# | ||
meta: | ||
id: attr_bad_valid_range | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
min: true | ||
max: '"qux"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# attr_bad_valid_repeat_eq_short.ksy: /seq/0/valid: | ||
# error: can't compare IntMultiType(true,Width4,Some(LittleEndian)) and ArrayTypeInStream(CalcIntType) | ||
# | ||
meta: | ||
id: attr_bad_valid_repeat_eq_short | ||
seq: | ||
- id: foo | ||
type: s4le | ||
valid: '[1000, -2000, 3000]' | ||
repeat: eos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# expr_broken_valid_eq_long.ksy: /seq/0/valid/eq: | ||
# error: parsing expression '1 *' failed on "*" at position 1:3, expected end-of-input | ||
# | ||
meta: | ||
id: expr_broken_valid_eq_long | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
eq: '1 *' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# expr_broken_valid_eq_short.ksy: /seq/0/valid: | ||
# error: parsing expression '1 *' failed on "*" at position 1:3, expected end-of-input | ||
# | ||
meta: | ||
id: expr_broken_valid_eq_short | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: '1 *' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/1: | ||
# error: unable to access 'bar' in expr_field_unknown_valid_any_of context | ||
# | ||
# expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/3: | ||
# error: unable to access 'qux' in expr_field_unknown_valid_any_of context | ||
# | ||
meta: | ||
id: expr_field_unknown_valid_any_of | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
any-of: | ||
- 0 | ||
- bar | ||
- 2 | ||
- qux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# expr_field_unknown_valid_eq_long.ksy: /seq/0/valid/eq: | ||
# error: unable to access 'bar' in expr_field_unknown_valid_eq_long context | ||
# | ||
meta: | ||
id: expr_field_unknown_valid_eq_long | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
eq: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# expr_field_unknown_valid_eq_short.ksy: /seq/0/valid: | ||
# error: unable to access 'bar' in expr_field_unknown_valid_eq_short context | ||
# | ||
meta: | ||
id: expr_field_unknown_valid_eq_short | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# expr_field_unknown_valid_expr.ksy: /seq/0/valid/expr: | ||
# error: unable to access 'bar' in expr_field_unknown_valid_expr context | ||
# | ||
meta: | ||
id: expr_field_unknown_valid_expr | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
expr: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# expr_field_unknown_valid_range.ksy: /seq/0/valid/min: | ||
# error: unable to access 'bar' in expr_field_unknown_valid_range context | ||
# | ||
# expr_field_unknown_valid_range.ksy: /seq/0/valid/max: | ||
# error: unable to access 'qux' in expr_field_unknown_valid_range context | ||
# | ||
meta: | ||
id: expr_field_unknown_valid_range | ||
seq: | ||
- id: foo | ||
type: u1 | ||
valid: | ||
min: bar | ||
max: qux |