From 98de9abe37965efa73daf533fd92b799a5a25947 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 17 Jan 2022 11:56:36 -0800 Subject: [PATCH] Update dev-dependencies --- Cargo.toml | 6 +++--- tests/quick.rs | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 34c4b873..4f2b30d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,9 +46,9 @@ default-features = false features = ["raw"] [dev-dependencies] -itertools = "0.9" -rand = {version = "0.7", features = ["small_rng"] } -quickcheck = { version = "0.9", default-features = false } +itertools = "0.10" +rand = {version = "0.8", features = ["small_rng"] } +quickcheck = { version = "1.0", default-features = false } fnv = "1.0" lazy_static = "1.3" fxhash = "0.2.1" diff --git a/tests/quick.rs b/tests/quick.rs index 848e14fc..5376e75a 100644 --- a/tests/quick.rs +++ b/tests/quick.rs @@ -6,8 +6,6 @@ use quickcheck::Arbitrary; use quickcheck::Gen; use quickcheck::TestResult; -use rand::Rng; - use fnv::FnvHasher; use std::hash::{BuildHasher, BuildHasherDefault}; type FnvBuilder = BuildHasherDefault; @@ -96,7 +94,8 @@ quickcheck! { true } - fn with_cap(cap: usize) -> bool { + fn with_cap(template: Vec<()>) -> bool { + let cap = template.len(); let map: IndexMap = IndexMap::with_capacity(cap); println!("wish: {}, got: {} (diff: {})", cap, map.capacity(), map.capacity() as isize - cap as isize); map.capacity() >= cap @@ -199,8 +198,8 @@ where K: Arbitrary, V: Arbitrary, { - fn arbitrary(g: &mut G) -> Self { - match g.gen::() % 4 { + fn arbitrary(g: &mut Gen) -> Self { + match u32::arbitrary(g) % 4 { 0 => Add(K::arbitrary(g), V::arbitrary(g)), 1 => AddEntry(K::arbitrary(g), V::arbitrary(g)), 2 => Remove(K::arbitrary(g)), @@ -452,12 +451,12 @@ impl Deref for Alpha { const ALPHABET: &[u8] = b"abcdefghijklmnopqrstuvwxyz"; impl Arbitrary for Alpha { - fn arbitrary(g: &mut G) -> Self { - let len = g.next_u32() % g.size() as u32; + fn arbitrary(g: &mut Gen) -> Self { + let len = usize::arbitrary(g) % g.size(); let len = min(len, 16); Alpha( (0..len) - .map(|_| ALPHABET[g.next_u32() as usize % ALPHABET.len()] as char) + .map(|_| ALPHABET[usize::arbitrary(g) % ALPHABET.len()] as char) .collect(), ) } @@ -482,8 +481,8 @@ impl Arbitrary for Large> where T: Arbitrary, { - fn arbitrary(g: &mut G) -> Self { - let len = g.next_u32() % (g.size() * 10) as u32; + fn arbitrary(g: &mut Gen) -> Self { + let len = usize::arbitrary(g) % (g.size() * 10); Large((0..len).map(|_| T::arbitrary(g)).collect()) }