diff options
author | iximeow <me@iximeow.net> | 2020-08-09 20:43:42 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-08-09 20:43:42 -0700 |
commit | 8f857a2fcbdfc7315cd09c0a4ac372b3ec92b538 (patch) | |
tree | 586778f7d1077ed737ab50e6055a9a5311ea1ad5 /test | |
parent | f523478b3c6f5f29f600368afb1b84c9f5a41eba (diff) |
adjust public interface: public items should all be stable
`OperandCode` (obviously) wildly varies depending on how i feel on a
given week, so it's now hidden to avoid people depending on numerical
values of its discriminants.
`RegisterBank` got a similar treatment with a new `RegisterClass` struct
that's suitable for public use.
Diffstat (limited to 'test')
-rw-r--r-- | test/long_mode/mod.rs | 2 | ||||
-rw-r--r-- | test/long_mode/regspec.rs | 19 | ||||
-rw-r--r-- | test/protected_mode/mod.rs | 2 | ||||
-rw-r--r-- | test/protected_mode/regspec.rs | 15 |
4 files changed, 36 insertions, 2 deletions
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index a3ff318..33fc8c7 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -12,7 +12,7 @@ fn test_invalid(data: &[u8]) { fn test_invalid_under(decoder: &InstDecoder, data: &[u8]) { if let Ok(inst) = decoder.decode(data.into_iter().cloned()) { - assert_eq!(inst.opcode, Opcode::Invalid, "decoded {:?} from {:02x?} under decoder {}", inst.opcode, data, decoder); + assert_eq!(inst.opcode(), Opcode::Invalid, "decoded {:?} from {:02x?} under decoder {}", inst.opcode(), data, decoder); } else { // this is fine } diff --git a/test/long_mode/regspec.rs b/test/long_mode/regspec.rs index 914c376..e126ac3 100644 --- a/test/long_mode/regspec.rs +++ b/test/long_mode/regspec.rs @@ -20,3 +20,22 @@ fn test_labels() { assert_eq!(RegSpec::gs().name(), "gs"); assert_eq!(RegSpec::al().name(), "al"); } + +#[test] +fn test_bank_names() { + assert_eq!(RegSpec::al().class().name(), "byte"); + assert_eq!(RegSpec::r8b().class().name(), "rex-byte"); + assert_eq!(RegSpec::ax().class().name(), "word"); + assert_eq!(RegSpec::eax().class().name(), "dword"); + assert_eq!(RegSpec::rax().class().name(), "qword"); + assert_eq!(RegSpec::fs().class().name(), "segment"); + assert_eq!(RegSpec::eflags().class().name(), "eflags"); + assert_eq!(RegSpec::rflags().class().name(), "rflags"); + assert_eq!(RegSpec::eip().class().name(), "eip"); + assert_eq!(RegSpec::rip().class().name(), "rip"); + assert_eq!(RegSpec::st0().class().name(), "x87-stack"); + assert_eq!(RegSpec::mm0().class().name(), "mmx"); + assert_eq!(RegSpec::xmm0().class().name(), "xmm"); + assert_eq!(RegSpec::ymm0().class().name(), "ymm"); + assert_eq!(RegSpec::zmm0().class().name(), "zmm"); +} diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs index bf9315c..c5c3c7b 100644 --- a/test/protected_mode/mod.rs +++ b/test/protected_mode/mod.rs @@ -12,7 +12,7 @@ fn test_invalid(data: &[u8]) { fn test_invalid_under(decoder: &InstDecoder, data: &[u8]) { if let Ok(inst) = decoder.decode(data.into_iter().cloned()) { - assert_eq!(inst.opcode, Opcode::Invalid, "decoded {:?} from {:02x?} under decoder {}", inst.opcode, data, decoder); + assert_eq!(inst.opcode(), Opcode::Invalid, "decoded {:?} from {:02x?} under decoder {}", inst.opcode(), data, decoder); } else { // this is fine } diff --git a/test/protected_mode/regspec.rs b/test/protected_mode/regspec.rs index bd996cc..eb8d018 100644 --- a/test/protected_mode/regspec.rs +++ b/test/protected_mode/regspec.rs @@ -18,3 +18,18 @@ fn test_labels() { assert_eq!(RegSpec::gs().name(), "gs"); assert_eq!(RegSpec::al().name(), "al"); } + +#[test] +fn test_bank_names() { + assert_eq!(RegSpec::al().class().name(), "byte"); + assert_eq!(RegSpec::ax().class().name(), "word"); + assert_eq!(RegSpec::eax().class().name(), "dword"); + assert_eq!(RegSpec::fs().class().name(), "segment"); + assert_eq!(RegSpec::eflags().class().name(), "eflags"); + assert_eq!(RegSpec::eip().class().name(), "eip"); + assert_eq!(RegSpec::st0().class().name(), "x87-stack"); + assert_eq!(RegSpec::mm0().class().name(), "mmx"); + assert_eq!(RegSpec::xmm0().class().name(), "xmm"); + assert_eq!(RegSpec::ymm0().class().name(), "ymm"); + assert_eq!(RegSpec::zmm0().class().name(), "zmm"); +} |