diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/long_mode/regspec.rs | 18 | ||||
-rw-r--r-- | test/protected_mode/regspec.rs | 18 |
2 files changed, 34 insertions, 2 deletions
diff --git a/test/long_mode/regspec.rs b/test/long_mode/regspec.rs index e126ac3..f92ec89 100644 --- a/test/long_mode/regspec.rs +++ b/test/long_mode/regspec.rs @@ -1,4 +1,4 @@ -use yaxpeax_x86::long_mode::RegSpec; +use yaxpeax_x86::long_mode::{register_class, RegSpec}; use std::collections::{BTreeMap, HashMap}; #[test] @@ -39,3 +39,19 @@ fn test_bank_names() { assert_eq!(RegSpec::ymm0().class().name(), "ymm"); assert_eq!(RegSpec::zmm0().class().name(), "zmm"); } + +// this should compile. +#[test] +fn match_bank_kind() { + match RegSpec::al().class() { + register_class::X => { + panic!("al is an xmm register? don't think so"); + } + register_class::B => { + println!("al is a byte register"); + } + other => { + panic!("unknown register kind: {:?}", other); + } + } +} diff --git a/test/protected_mode/regspec.rs b/test/protected_mode/regspec.rs index eb8d018..7d43c7a 100644 --- a/test/protected_mode/regspec.rs +++ b/test/protected_mode/regspec.rs @@ -1,4 +1,4 @@ -use yaxpeax_x86::protected_mode::RegSpec; +use yaxpeax_x86::protected_mode::{register_class, RegSpec}; use std::collections::{BTreeMap, HashMap}; #[test] @@ -33,3 +33,19 @@ fn test_bank_names() { assert_eq!(RegSpec::ymm0().class().name(), "ymm"); assert_eq!(RegSpec::zmm0().class().name(), "zmm"); } + +// this should compile. +#[test] +fn match_bank_kind() { + match RegSpec::al().class() { + register_class::X => { + panic!("al is an xmm register? don't think so"); + } + register_class::B => { + println!("al is a byte register"); + } + other => { + panic!("unknown register kind: {:?}", other); + } + } +} |