From 3be0078cb83af49e4755d53621746ef318ab963e Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 6 Jul 2021 17:41:09 -0700 Subject: update yaxpeax-arch to 0.2.2, corresponding API updates. tag 0.1.0 --- test/test.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test.rs b/test/test.rs index 5a84a6d..0089abf 100644 --- a/test/test.rs +++ b/test/test.rs @@ -1,4 +1,4 @@ -use yaxpeax_arch::{Decoder, LengthedInstruction}; +use yaxpeax_arch::{Decoder, LengthedInstruction, U8Reader}; use yaxpeax_m16c::InstDecoder; use std::fmt::Write; @@ -9,7 +9,8 @@ fn test_display(data: &[u8], expected: &'static str) { fn test_invalid(data: &[u8]) { let decoder = InstDecoder::default(); - match decoder.decode(data.into_iter().map(|x| *x)) { + let mut reader = U8Reader::new(data); + match decoder.decode(&mut reader) { Ok(instr) => { assert!(false, "incorrectly decoded {:?} from {:02x?} under decoder {}", instr, data, decoder); }, @@ -25,7 +26,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!( @@ -39,7 +41,7 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str ); // while we're at it, test that the instruction is as long, and no longer, than its // input - assert_eq!(instr.len() as usize, data.len(), "instruction length is incorrect, wanted instruction {}", expected); + assert_eq!(instr.len().to_const() as usize, data.len(), "instruction length is incorrect, wanted instruction {}", expected); }, Err(e) => { assert!(false, "decode error ({}) for {} under decoder {}:\n expected: {}\n", e, hex, decoder, expected); -- cgit v1.1