blob: 48cf90b007f917154905031fadd59c19d42258f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
extern crate yaxpeax_arch;
extern crate yaxpeax_msp430_mc;
use yaxpeax_arch::Decodable;
use yaxpeax_msp430_mc::{Instruction, Opcode};
#[test]
fn test_decode() {
let data = [0x02, 0x12];
let mut instr = Instruction::blank();
instr.decode_into(data.iter().map(|x| *x));
assert!(instr.opcode == Opcode::PUSH);
let data = [0xb1, 0x92, 0x8d, 0x49];
let mut instr = Instruction::blank();
instr.decode_into(data.iter().map(|x| *x));
assert!(instr.opcode == Opcode::CMP);
let data = [0x12, 0x00, 0x3f, 0x40];
let mut instr = Instruction::blank();
instr.decode_into(data.iter().map(|x| *x));
assert!(instr.opcode == Opcode::RRC);
let data = [0x20, 0x0e];
let mut instr = Instruction::blank();
instr.decode_into(data.iter().map(|x| *x));
assert!(instr.opcode == Opcode::PUSH);
}
|