From 49b3c8ec9e5f679690b9a12166045e4dec18ff05 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 6 Jul 2021 19:19:07 -0700 Subject: update yaxpeax-arch to 0.2.3, fix API changes, update crate to rust 2018 --- test/test.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'test') 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!( -- cgit v1.1