From bd9ae00ba84275c9414298d016da21e8106cda36 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 11 Feb 2020 00:22:16 -0800 Subject: add `RegSpec::name` to get `&'static str` labels for registers --- test/regspec.rs | 22 ++++++++++++++++++++++ test/test.rs | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 test/regspec.rs (limited to 'test') diff --git a/test/regspec.rs b/test/regspec.rs new file mode 100644 index 0000000..914c376 --- /dev/null +++ b/test/regspec.rs @@ -0,0 +1,22 @@ +use yaxpeax_x86::long_mode::RegSpec; +use std::collections::{BTreeMap, HashMap}; + +#[test] +fn test_ord() { + let _: BTreeMap = BTreeMap::new(); +} + +#[test] +fn test_hash() { + let _: HashMap = HashMap::new(); +} + +#[test] +fn test_labels() { + assert_eq!(RegSpec::rip().name(), "rip"); + assert_eq!(RegSpec::eip().name(), "eip"); + assert_eq!(RegSpec::rflags().name(), "rflags"); + assert_eq!(RegSpec::rbp().name(), "rbp"); + assert_eq!(RegSpec::gs().name(), "gs"); + assert_eq!(RegSpec::al().name(), "al"); +} diff --git a/test/test.rs b/test/test.rs index 5ba8bd9..6bc8972 100644 --- a/test/test.rs +++ b/test/test.rs @@ -1,6 +1,8 @@ extern crate yaxpeax_arch; extern crate yaxpeax_x86; +mod regspec; + use std::fmt::Write; use yaxpeax_arch::{Decoder, LengthedInstruction}; -- cgit v1.1