Skip to content

Commit

Permalink
Add ValidFailRepeat{Contents,Expr,Inst,{Anyof,Eq,Max,Min}Int}
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Jul 16, 2024
1 parent 9fd16de commit 98a68fc
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 1 deletion.
2 changes: 1 addition & 1 deletion formats/valid_fail_expr.ksy
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ seq:
expr: _ == 1
- id: bar
type: s2le
valid: # there's actually -190 in the file
valid: # there is actually -190 in the file
expr: _ < -190 or _ > -190
11 changes: 11 additions & 0 deletions formats/valid_fail_repeat_anyof_int.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta:
id: valid_fail_repeat_anyof_int
seq:
- id: foo
type: u1
valid: # there is actually 0xe8 in the file
any-of:
- 0
- 1
- 0x41
repeat: eos
6 changes: 6 additions & 0 deletions formats/valid_fail_repeat_contents.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
meta:
id: valid_fail_repeat_contents
seq:
- id: foo
contents: [0x12, 0x34, 0x56, 0x78] # there is actually [0x00, 0x12, 0x34, 0x56] in the file
repeat: eos
8 changes: 8 additions & 0 deletions formats/valid_fail_repeat_eq_int.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
meta:
id: valid_fail_repeat_eq_int
endian: be
seq:
- id: foo
type: u4
valid: 0x12_34_56_78 # there is actually 0x00_12_34_56 in the file
repeat: eos
10 changes: 10 additions & 0 deletions formats/valid_fail_repeat_expr.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
meta:
id: valid_fail_repeat_expr
seq:
- id: foo
size: 4
valid:
# there is actually [0x00, 0x12, 0x34, 0x56] in the file
# (this `valid/expr` asserts that this particular value does not occur)
expr: _ != [0x00, 0x12, 0x34, 0x56]
repeat: eos
13 changes: 13 additions & 0 deletions formats/valid_fail_repeat_inst.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
meta:
id: valid_fail_repeat_inst
endian: be
seq:
- id: a
size: 0
if: inst.size == 0 # invoke instance
instances:
inst:
pos: 0
type: u4
valid: 0x12_34_56_78 # there is actually 0x00_12_34_56 in the file
repeat: eos
8 changes: 8 additions & 0 deletions formats/valid_fail_repeat_max_int.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
meta:
id: valid_fail_repeat_max_int
seq:
- id: foo
type: u1
valid:
max: 0xfe # there is actually 0xff in the file
repeat: eos
8 changes: 8 additions & 0 deletions formats/valid_fail_repeat_min_int.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
meta:
id: valid_fail_repeat_min_int
seq:
- id: foo
type: s1
valid:
min: 0 # there is actually -24 (0xe8) in the file
repeat: eos
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_anyof_int.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_anyof_int
data: process_coerce_bytes.bin
exception: ValidationNotAnyOfError<u1>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_contents.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_contents
data: bcd_user_type_be.bin
exception: ValidationNotEqualError<bytes>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_eq_int.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_eq_int
data: bcd_user_type_be.bin
exception: ValidationNotEqualError<u4>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_expr.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_expr
data: bcd_user_type_be.bin
exception: ValidationExprError<bytes>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_inst.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_inst
data: bcd_user_type_be.bin
exception: ValidationNotEqualError<u4>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_max_int.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_max_int
data: nav_parent_switch.bin
exception: ValidationGreaterThanError<u1>
3 changes: 3 additions & 0 deletions spec/ks/valid_fail_repeat_min_int.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id: valid_fail_repeat_min_int
data: process_coerce_bytes.bin
exception: ValidationLessThanError<s1>

0 comments on commit 98a68fc

Please sign in to comment.