diff options
author | iximeow <me@iximeow.net> | 2019-03-31 11:36:46 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 17:07:40 -0800 |
commit | 8734e0cea4778fbdc9f93a70f86e709b14ce2fb3 (patch) | |
tree | 79605330d96ca5a722136d151710db2c0a283ba9 | |
parent | dad3bed68d442f23e484a963eda9a6812e67c7c4 (diff) |
why werent msp430 tests committed??
-rw-r--r-- | test/test.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test.rs b/test/test.rs new file mode 100644 index 0000000..a917ba9 --- /dev/null +++ b/test/test.rs @@ -0,0 +1,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); + assert!(instr.opcode == Opcode::PUSH); + + let data = [0xb1, 0x92, 0x8d, 0x49]; + let mut instr = Instruction::blank(); + instr.decode_into(&data); + assert!(instr.opcode == Opcode::CMP); + + let data = [0x12, 0x00, 0x3f, 0x40]; + let mut instr = Instruction::blank(); + instr.decode_into(&data); + assert!(instr.opcode == Opcode::RRC); + + let data = [0x20, 0x0e]; + let mut instr = Instruction::blank(); + instr.decode_into(&data); + assert!(instr.opcode == Opcode::PUSH); +} |