diff options
author | iximeow <me@iximeow.net> | 2021-07-06 18:19:19 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-06 18:21:16 -0700 |
commit | e98b04b473465a161aefd8d6cf7213f08b54758f (patch) | |
tree | 99e3c5ae7792e36229afeb20750e1b81b33d7210 /test | |
parent | 0eed3ca0c9413071a15bd5171a3522a413aae383 (diff) |
update yaxpeax-arch to 0.2.3, tag 0.1.00.1.0
Diffstat (limited to 'test')
-rw-r--r-- | test/test.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test.rs b/test/test.rs index 663b080..eb2399e 100644 --- a/test/test.rs +++ b/test/test.rs @@ -1,26 +1,26 @@ extern crate yaxpeax_arch; extern crate yaxpeax_msp430; -use yaxpeax_arch::{Arch, Decoder}; +use yaxpeax_arch::{Arch, Decoder, U8Reader}; use yaxpeax_msp430::{Opcode, MSP430}; #[test] fn test_decode() { - let decoder = <MSP430 as Arch>::Decoder::default(); + fn decode(bytes: &[u8]) -> yaxpeax_msp430::Instruction { + let decoder = <MSP430 as Arch>::Decoder::default(); + let mut reader = U8Reader::new(bytes); + decoder.decode(&mut reader).unwrap() + } - let data = [0x02, 0x12]; - let instr = decoder.decode(data.iter().cloned()).unwrap(); + let instr = decode(&[0x02, 0x12][..]); assert!(instr.opcode == Opcode::PUSH); - let data = [0xb1, 0x92, 0x8d, 0x49]; - let instr = decoder.decode(data.iter().cloned()).unwrap(); + let instr = decode(&[0xb1, 0x92, 0x8d, 0x49][..]); assert!(instr.opcode == Opcode::CMP); - let data = [0x12, 0x00, 0x3f, 0x40]; - let instr = decoder.decode(data.iter().cloned()).unwrap(); + let instr = decode(&[0x12, 0x00, 0x3f, 0x40][..]); assert!(instr.opcode == Opcode::RRC); - let data = [0x20, 0x0e]; - let instr = decoder.decode(data.iter().cloned()).unwrap(); + let instr = decode(&[0x20, 0x0e][..]); assert!(instr.opcode == Opcode::PUSH); } |