summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-11-28 02:22:02 -0800
committeriximeow <me@iximeow.net>2020-01-12 17:08:59 -0800
commit693e21378ecec332254d48642cd7b751cabeb6da (patch)
tree045f11fa14331e92ce65f48f53b6a350b06a1e60 /test
parentd1de407ea3a157e7b0aa39ac03e5d16a001bd783 (diff)
update msp430 to revised decoder trait
Diffstat (limited to 'test')
-rw-r--r--test/test.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/test.rs b/test/test.rs
index 48cf90b..5a59df4 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -1,28 +1,26 @@
extern crate yaxpeax_arch;
extern crate yaxpeax_msp430_mc;
-use yaxpeax_arch::Decodable;
-use yaxpeax_msp430_mc::{Instruction, Opcode};
+use yaxpeax_arch::{Arch, Decoder};
+use yaxpeax_msp430_mc::{Opcode, MSP430};
#[test]
fn test_decode() {
+ let decoder = <MSP430 as Arch>::Decoder::default();
+
let data = [0x02, 0x12];
- let mut instr = Instruction::blank();
- instr.decode_into(data.iter().map(|x| *x));
+ let instr = decoder.decode(data.iter().cloned()).unwrap();
assert!(instr.opcode == Opcode::PUSH);
let data = [0xb1, 0x92, 0x8d, 0x49];
- let mut instr = Instruction::blank();
- instr.decode_into(data.iter().map(|x| *x));
+ let instr = decoder.decode(data.iter().cloned()).unwrap();
assert!(instr.opcode == Opcode::CMP);
let data = [0x12, 0x00, 0x3f, 0x40];
- let mut instr = Instruction::blank();
- instr.decode_into(data.iter().map(|x| *x));
+ let instr = decoder.decode(data.iter().cloned()).unwrap();
assert!(instr.opcode == Opcode::RRC);
let data = [0x20, 0x0e];
- let mut instr = Instruction::blank();
- instr.decode_into(data.iter().map(|x| *x));
+ let instr = decoder.decode(data.iter().cloned()).unwrap();
assert!(instr.opcode == Opcode::PUSH);
}