aboutsummaryrefslogtreecommitdiff
path: root/test/protected_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-12-19 09:06:12 -0800
committeriximeow <me@iximeow.net>2021-12-19 09:09:20 -0800
commitd13d8ebfad98b3d547f455ec9d73dab98f0899c3 (patch)
tree7abee6076688c087a2a45a84ae562f0cb59a8c94 /test/protected_mode/mod.rs
parent060fb29180f354e04ec8d48f0128433b634fa3c5 (diff)
test that invalid RegSpec constructions panic as expected
in the process, fix 64-bit rex-byte limit, 32/16-bit mode mask reg limit
Diffstat (limited to 'test/protected_mode/mod.rs')
-rw-r--r--test/protected_mode/mod.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index 1b0ca59..9f34019 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -3084,3 +3084,55 @@ fn from_reports() {
test_display(&[0x62, 0xf2, 0x6d, 0xac, 0x00, 0x59, 0xa7], "vpshufb ymm3{k4}{z}, ymm2, ymmword [ecx - 0xb20]");
test_display(&[0x62, 0xf2, 0xfd, 0x0f, 0x8a, 0x62, 0xf2], "vcompresspd xmmword [edx - 0x70]{k7}, xmm4");
}
+
+mod reg_masks {
+ use yaxpeax_x86::protected_mode::RegSpec;
+
+ #[test]
+ #[should_panic]
+ fn invalid_mask_reg_panics() {
+ RegSpec::mask(8);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_dword_reg_panics() {
+ RegSpec::d(8);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_word_reg_panics() {
+ RegSpec::w(8);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_byte_reg_panics() {
+ RegSpec::b(8);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_x87_reg_panics() {
+ RegSpec::st(8);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_xmm_reg_panics() {
+ RegSpec::xmm(32);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_ymm_reg_panics() {
+ RegSpec::ymm(32);
+ }
+
+ #[test]
+ #[should_panic]
+ fn invalid_zmm_reg_panics() {
+ RegSpec::zmm(32);
+ }
+}