aboutsummaryrefslogtreecommitdiff
path: root/test/test.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-01-13 19:58:05 -0800
committeriximeow <me@iximeow.net>2020-01-13 20:07:28 -0800
commit9835359ed86e3cb570418bc15234fbb7aca4cee8 (patch)
tree9366a4bdefa83aa39591b4acbad9215e73e09833 /test/test.rs
parentbda346a0caac6896fbc90a61d5d3d15dbc4fb79f (diff)
add Default impl for Instruction to track yaxpeax-arch
Diffstat (limited to 'test/test.rs')
-rw-r--r--test/test.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/test/test.rs b/test/test.rs
index 7726bb7..0ffc1c4 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -3,26 +3,8 @@ extern crate yaxpeax_x86;
use std::fmt::Write;
-use yaxpeax_arch::Decoder;
-use yaxpeax_x86::{Instruction, InstDecoder, decode_one};
-
-#[allow(dead_code)]
-fn decode(bytes: &[u8]) -> Option<Instruction> {
- let mut instr = Instruction::invalid();
- match decode_one(&InstDecoder::default(), bytes.iter().map(|x| *x).take(16).collect::<Vec<u8>>(), &mut instr) {
- Ok(()) => Some(instr),
- _ => None
- }
-}
-
-#[allow(dead_code)]
-fn decode_as(decoder: &InstDecoder, bytes: &[u8]) -> Option<Instruction> {
- let mut instr = Instruction::invalid();
- match decode_one(decoder, bytes.iter().map(|x| *x).take(16).collect::<Vec<u8>>(), &mut instr) {
- Ok(()) => Some(instr),
- _ => None
- }
-}
+use yaxpeax_arch::{Decoder, LengthedInstruction};
+use yaxpeax_x86::{Instruction, InstDecoder};
fn test_invalid(data: &[u8]) {
test_invalid_under(&InstDecoder::default(), data);