mirror of
https://github.com/Noratrieb/rustv32i.git
synced 2026-01-16 14:25:02 +01:00
add exhaustive_decode_no_panic
better than a fuzzer!
This commit is contained in:
parent
4965493a0e
commit
af84ff7ca6
1 changed files with 23 additions and 0 deletions
23
src/inst.rs
23
src/inst.rs
|
|
@ -1120,3 +1120,26 @@ impl Inst {
|
||||||
Ok(inst)
|
Ok(inst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn exhaustive_decode_no_panic() {
|
||||||
|
if std::env::var("SLOW_TESTS").is_err() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in 0..u32::MAX {
|
||||||
|
if (i % (2 << 25)) == 0 {
|
||||||
|
let percent = i as f32 / (u32::MAX as f32);
|
||||||
|
let done = (100.0 * percent) as usize;
|
||||||
|
print!("\r{}{}", "#".repeat(done), "-".repeat(100 - done));
|
||||||
|
std::io::stdout().flush().unwrap();
|
||||||
|
}
|
||||||
|
let _ = super::Inst::decode(i);
|
||||||
|
}
|
||||||
|
let _ = super::Inst::decode(u32::MAX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue