diff options
author | iximeow <me@iximeow.net> | 2022-01-21 18:25:40 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2022-01-21 18:25:40 -0800 |
commit | 35222d0f9f33e86a6046fad1f0d6a7e09656016b (patch) | |
tree | 7ddb4998a851ce09ad0420940aef7eed8f1eb252 /tests | |
parent | 86510eeed5e69c57f3677d4970e22d4f717e3284 (diff) |
add test that the nd812 disassembler does not panic
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test.rs b/tests/test.rs index d2750ee..a0e200b 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -27,6 +27,26 @@ fn test_display(data: &[u16], expected: &'static str) { } #[test] +fn test_decoder_does_not_panic() { + for i in 0..0o7777_7777 { + let low = (i & 0o7777) as u16; + let high = (i >> 12) as u16; + let data = &[low, high]; + let mut reader = yaxpeax_nd812::ND812Reader::of_u16(data); + match yaxpeax_nd812::InstDecoder::default().decode(&mut reader) { + Ok(instr) => { + let displayed = instr.to_string(); + assert!(displayed.len() > 0); + } + Err(e) => { + let displayed = e.to_string(); + assert!(displayed.len() > 0); + } + } + + } +} +#[test] fn test_disassembly() { test_display(&[0o5464], "stj $+0x34"); // symbol name from IM41-1085 test_display(&[0o6137], "jmp $-0x1f"); // symbol name from IM41-1085 |