summaryrefslogtreecommitdiff
path: root/test/test.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-07-06 19:19:07 -0700
committeriximeow <me@iximeow.net>2021-07-06 19:19:07 -0700
commit49b3c8ec9e5f679690b9a12166045e4dec18ff05 (patch)
tree67866d650acb07a916b39e923688e29668ec339e /test/test.rs
parent589e11b0e1ff53f4d3e8edff2e77c72df38036f8 (diff)
update yaxpeax-arch to 0.2.3, fix API changes, update crate to rust 20180.2.0no-gods-no-
Diffstat (limited to 'test/test.rs')
-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!(