aboutsummaryrefslogtreecommitdiff
path: root/test/protected_mode
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-08-15 11:38:15 -0700
committeriximeow <me@iximeow.net>2020-08-15 11:39:04 -0700
commita0b1fddbb55cbab9d482d4f8cffc7ffe87f73864 (patch)
tree0f94f4bb1809dbdf3ef01170884757d0488f78c1 /test/protected_mode
parent6248d3c5f7dd196acdfce5c0da1608fed81b43cd (diff)
add register class constants to allow reasoning about register operands0.1.1
also bump to 0.1.1
Diffstat (limited to 'test/protected_mode')
-rw-r--r--test/protected_mode/regspec.rs18
1 files changed, 17 insertions, 1 deletions
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);
+ }
+ }
+}