diff options
Diffstat (limited to 'test/protected_mode/operand.rs')
-rw-r--r-- | test/protected_mode/operand.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/protected_mode/operand.rs b/test/protected_mode/operand.rs index fd850da..a114e69 100644 --- a/test/protected_mode/operand.rs +++ b/test/protected_mode/operand.rs @@ -26,3 +26,21 @@ fn memory_widths() { assert_eq!(mem_size_of(&[0x66, 0x33, 0x00]).size_name(), "word"); assert_eq!(mem_size_of(&[0x33, 0x00]).size_name(), "dword"); } + +#[test] +fn test_implied_memory_width() { + fn mem_size_of(data: &[u8]) -> Option<u8> { + let decoder = InstDecoder::default(); + decoder.decode_slice(data).unwrap().mem_size().unwrap().bytes_size() + } + + // test push, pop, call, and ret + assert_eq!(mem_size_of(&[0xc3]), Some(4)); + assert_eq!(mem_size_of(&[0xe8, 0x11, 0x22, 0x33, 0x44]), Some(4)); + assert_eq!(mem_size_of(&[0x50]), Some(4)); + assert_eq!(mem_size_of(&[0x58]), Some(4)); + assert_eq!(mem_size_of(&[0x66, 0x50]), Some(4)); + assert_eq!(mem_size_of(&[0x66, 0x58]), Some(4)); + assert_eq!(mem_size_of(&[0xff, 0xf0]), Some(4)); + assert_eq!(mem_size_of(&[0x66, 0xff, 0xf0]), Some(2)); +} |