From fd2ad942d24e115cbb66aaf455a9053afba3b4db Mon Sep 17 00:00:00 2001 From: tottoto Date: Fri, 16 Feb 2024 07:09:50 +0900 Subject: [PATCH] chore: update to quickcheck 1 --- Cargo.toml | 4 ++-- tests/header_map_fuzz.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f20e71f..f3de5d3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,8 +43,8 @@ itoa = "1" [dev-dependencies] indexmap = "<=1.8" -quickcheck = "0.9.0" -rand = "0.7.0" +quickcheck = "1" +rand = "0.8.0" seahash = "3.0.5" serde = "1.0" serde_json = "1.0" diff --git a/tests/header_map_fuzz.rs b/tests/header_map_fuzz.rs index c3af2e52..ed80986e 100644 --- a/tests/header_map_fuzz.rs +++ b/tests/header_map_fuzz.rs @@ -76,12 +76,12 @@ impl Fuzz { let mut steps = vec![]; let mut expect = AltMap::default(); - let num = rng.gen_range(5, 500); + let num = rng.gen_range(5..500); let weight = Weight { - insert: rng.gen_range(1, 10), - remove: rng.gen_range(1, 10), - append: rng.gen_range(1, 10), + insert: rng.gen_range(1..10), + remove: rng.gen_range(1..10), + append: rng.gen_range(1..10), }; while steps.len() < num { @@ -111,8 +111,8 @@ impl Fuzz { } impl Arbitrary for Fuzz { - fn arbitrary(g: &mut G) -> Self { - Fuzz::new(Rng::gen(g)) + fn arbitrary(_: &mut Gen) -> Self { + Self::new(rand::thread_rng().gen()) } } @@ -130,7 +130,7 @@ impl AltMap { fn gen_action(&mut self, weight: &Weight, rng: &mut StdRng) -> Action { let sum = weight.insert + weight.remove + weight.append; - let mut num = rng.gen_range(0, sum); + let mut num = rng.gen_range(0..sum); if num < weight.insert { return self.gen_insert(rng); @@ -213,7 +213,7 @@ impl AltMap { if self.map.is_empty() { None } else { - let n = rng.gen_range(0, self.map.len()); + let n = rng.gen_range(0..self.map.len()); self.map.keys().nth(n).map(Clone::clone) } }