diff --git a/formats/switch_default_only.ksy b/formats/switch_default_only.ksy new file mode 100644 index 000000000..11f6281ad --- /dev/null +++ b/formats/switch_default_only.ksy @@ -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 diff --git a/spec/ks/switch_default_only.kst b/spec/ks/switch_default_only.kst new file mode 100644 index 000000000..833c32b01 --- /dev/null +++ b/spec/ks/switch_default_only.kst @@ -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]'