Skip to content

Commit

Permalink
Add switch_default_only format+KST
Browse files Browse the repository at this point in the history
Demonstrates possible issues like kaitai-io/kaitai_struct#595
and kaitai-io/kaitai_struct#415
  • Loading branch information
generalmimon committed Feb 29, 2020
1 parent fff2200 commit b1677f6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions formats/switch_default_only.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
meta:
id: switch_default_only
seq:
- id: opcode
type: s1
- id: byte
type:
switch-on: opcode
cases:
_: s1
- id: struct
type:
switch-on: opcode
cases:
_: data
- id: struct_sized
type:
switch-on: opcode
cases:
_: data
size: 4
types:
data:
seq:
- id: value
size: 4
11 changes: 11 additions & 0 deletions spec/ks/switch_default_only.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id: switch_default_only
data: switch_opcodes.bin
asserts:
- actual: opcode
expected: 0x53
- actual: byte
expected: 0x66
- actual: struct.value
expected: '[0x6f, 0x6f, 0x62, 0x61]'
- actual: struct_sized.value
expected: '[0x72, 0x00, 0x49, 0x42]'

0 comments on commit b1677f6

Please sign in to comment.