diff options
author | iximeow <me@iximeow.net> | 2021-07-06 17:41:09 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-06 17:41:09 -0700 |
commit | 3be0078cb83af49e4755d53621746ef318ab963e (patch) | |
tree | 1525733d46771623689780708e8f836db2b46420 /test | |
parent | 5ff3f2ea5e3960b41c1b7647db738d9d905b58ec (diff) |
update yaxpeax-arch to 0.2.2, corresponding API updates. tag 0.1.0HEAD0.1.0no-gods-no-
Diffstat (limited to 'test')
-rw-r--r-- | test/test.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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); |