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/long_mode/regspec.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'test/long_mode/regspec.rs') 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); + } + } +} -- cgit v1.1