summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/test.rs b/test/test.rs
index 856db45..613dc54 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -1,9 +1,6 @@
use std::fmt::Write;
-extern crate yaxpeax_arch;
-extern crate yaxpeax_sm83;
-
-use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction};
+use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction, U8Reader};
use yaxpeax_sm83::InstDecoder;
fn test_invalid(data: &[u8]) {
@@ -11,7 +8,8 @@ fn test_invalid(data: &[u8]) {
}
fn test_invalid_under(decoder: &InstDecoder, data: &[u8]) {
- if let Ok(inst) = decoder.decode(data.into_iter().cloned()) {
+ let mut reader = U8Reader::new(data);
+ if let Ok(inst) = decoder.decode(&mut reader) {
panic!("decoded {:?} from {:02x?}", inst.opcode(), data);
} else {
// this is fine
@@ -27,7 +25,8 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str
for b in data {
write!(hex, "{:02x}", b).unwrap();
}
- match decoder.decode(data.into_iter().map(|x| *x)) {
+ let mut reader = U8Reader::new(data);
+ match decoder.decode(&mut reader) {
Ok(instr) => {
let text = format!("{}", instr);
assert!(