summaryrefslogtreecommitdiff
path: root/test/test.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-07-06 17:50:56 -0700
committeriximeow <me@iximeow.net>2021-07-06 17:52:31 -0700
commitbc3bf7337fc643b55bf7e599c1a488b999b1e73c (patch)
tree1f609f284518c4d468855995804967005446d5fd /test/test.rs
parentbd0ecaafb838f02bb6064b6abb5dcb8910422d2b (diff)
update yaxpeax-arch to 0.1.0, update implsHEAD0.1.0no-gods-no-
Diffstat (limited to 'test/test.rs')
-rw-r--r--test/test.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/test.rs b/test/test.rs
index 431a349..0238853 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -1,12 +1,13 @@
extern crate yaxpeax_arch;
extern crate yaxpeax_mips;
-use yaxpeax_arch::{Arch, Decoder};
+use yaxpeax_arch::{Arch, Decoder, U8Reader};
use yaxpeax_mips::{MIPS, Instruction}; //, Opcode};
#[allow(dead_code)]
fn test_decode(data: [u8; 4], expected: Instruction) {
- let instr = <MIPS as Arch>::Decoder::default().decode(data.to_vec()).unwrap();
+ let mut reader = U8Reader::new(&data[..]);
+ let instr = <MIPS as Arch>::Decoder::default().decode(&mut reader).unwrap();
assert!(
instr == expected,
"decode error for {:02x}{:02x}{:02x}{:02x}:\n decoded: {:?}\n expected: {:?}\n",
@@ -16,7 +17,8 @@ fn test_decode(data: [u8; 4], expected: Instruction) {
}
fn test_display(data: [u8; 4], expected: &'static str) {
- let instr = <MIPS as Arch>::Decoder::default().decode(data.to_vec()).unwrap();
+ let mut reader = U8Reader::new(&data[..]);
+ let instr = <MIPS as Arch>::Decoder::default().decode(&mut reader).unwrap();
let text = format!("{}", instr);
assert!(
text == expected,