parent
4931db6469
commit
081c218737
@ -520,19 +520,15 @@ mod tests {
|
|||||||
log::trace!("{:?}", input.bytes());
|
log::trace!("{:?}", input.bytes());
|
||||||
|
|
||||||
// The pre-seeded rand should have spliced at position 2.
|
// The pre-seeded rand should have spliced at position 2.
|
||||||
assert_eq!(input.bytes(), &[b'a', b'b', b'f']);
|
assert_eq!(input.bytes(), b"abf");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_havoc() {
|
fn test_havoc() {
|
||||||
let rand = StdRand::with_seed(0x1337);
|
let rand = StdRand::with_seed(0x1337);
|
||||||
let mut corpus: InMemoryCorpus<BytesInput> = InMemoryCorpus::new();
|
let mut corpus: InMemoryCorpus<BytesInput> = InMemoryCorpus::new();
|
||||||
corpus
|
corpus.add(Testcase::new(b"abc".to_vec().into())).unwrap();
|
||||||
.add(Testcase::new(vec![b'a', b'b', b'c'].into()))
|
corpus.add(Testcase::new(b"def".to_vec().into())).unwrap();
|
||||||
.unwrap();
|
|
||||||
corpus
|
|
||||||
.add(Testcase::new(vec![b'd', b'e', b'f'].into()))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut input = corpus.cloned_input_for_id(corpus.first().unwrap()).unwrap();
|
let mut input = corpus.cloned_input_for_id(corpus.first().unwrap()).unwrap();
|
||||||
let input_prior = input.clone();
|
let input_prior = input.clone();
|
||||||
|
@ -25,14 +25,14 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
let mut hasher =
|
let mut hasher =
|
||||||
black_box(ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher());
|
black_box(ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher());
|
||||||
hasher.write(black_box(&bench_vec));
|
hasher.write(black_box(&bench_vec));
|
||||||
hasher.finish();
|
black_box(hasher.finish());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
c.bench_function("fxhash", |b| {
|
c.bench_function("fxhash", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut hasher = black_box(rustc_hash::FxHasher::default());
|
let mut hasher = black_box(rustc_hash::FxHasher::default());
|
||||||
hasher.write(black_box(&bench_vec));
|
hasher.write(black_box(&bench_vec));
|
||||||
hasher.finish();
|
black_box(hasher.finish());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user