fix(bytecode): make sure the proptest runs long enough
This commit is contained in:
parent
7c992a5c84
commit
ec6eed9a7f
2 changed files with 16 additions and 6 deletions
|
@ -93,11 +93,16 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
proptest::proptest! {
|
||||
#![proptest_config(proptest::prelude::ProptestConfig::with_cases(4096))]
|
||||
|
||||
#[test]
|
||||
fn doesnt_crash(inp in proptest::collection::vec(0..=u8::MAX, 0..256)) {
|
||||
if let Ok((_, v)) = <Instr as crate::Parse<'_>>::parse(&inp[..]) {
|
||||
let mut buf = alloc::vec::Vec::with_capacity(inp.len());
|
||||
fn doesnt_crash(inp in proptest::collection::vec(0..=u8::MAX, 0..1024)) {
|
||||
let mut inp = &inp[..];
|
||||
while let Ok((xinp, v)) = <Instr as crate::Parse<'_>>::parse(&inp[..]) {
|
||||
let mut buf = alloc::vec::Vec::with_capacity(inp.len() - xinp.len());
|
||||
v.write_to(&mut buf).unwrap();
|
||||
assert_eq!(buf[..], inp[..inp.len() - xinp.len()]);
|
||||
inp = xinp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,11 +110,16 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
proptest::proptest! {
|
||||
#![proptest_config(proptest::prelude::ProptestConfig::with_cases(4096))]
|
||||
|
||||
#[test]
|
||||
fn doesnt_crash(inp in proptest::collection::vec(0..=u8::MAX, 0..256)) {
|
||||
if let Ok((_, v)) = <Value as crate::Parse<'_>>::parse(&inp[..]) {
|
||||
let mut buf = alloc::vec::Vec::with_capacity(inp.len());
|
||||
fn doesnt_crash(inp in proptest::collection::vec(0..=u8::MAX, 0..1024)) {
|
||||
let mut inp = &inp[..];
|
||||
while let Ok((xinp, v)) = <Value as crate::Parse<'_>>::parse(&inp[..]) {
|
||||
let mut buf = alloc::vec::Vec::with_capacity(inp.len() - xinp.len());
|
||||
v.write_to(&mut buf).unwrap();
|
||||
assert_eq!(buf[..], inp[..inp.len() - xinp.len()]);
|
||||
inp = xinp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue