From a0b1fddbb55cbab9d482d4f8cffc7ffe87f73864 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 15 Aug 2020 11:38:15 -0700 Subject: add register class constants to allow reasoning about register operands also bump to 0.1.1 --- test/protected_mode/regspec.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'test/protected_mode') 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); + } + } +} -- cgit v1.1