-
Notifications
You must be signed in to change notification settings - Fork 1.2k
build(deps): Bump rand to 0.8 and quickcheck to 1 #2857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
e482d91
Upgrade to rand 0.8
kpp 23c65e7
Fix compiler warning
kpp 94634c2
Upgrade tests to quickcheck=1
kpp 7ac75e9
cargo fmt
kpp f1e4833
Remove rand dep from dev workspace
kpp a36e551
Remove Rng param from fn random_peers
kpp cff5192
Fix kad:rand_distance test
kpp 7dd2ab6
Fix kad:bucket_contains_range test
kpp d805059
Fix kad:closest_and_disjoint_closest_yield_same_result test
kpp c092d1b
Fix swarm:score_retention test
kpp ea2e1ab
Merge branch 'master' into rand08
kpp f6f6899
Apply suggestions from code review for over/under-flow
kpp 55ed655
cargo fmt
kpp cc64494
Introduce quickcheck-ext crate with Gen::gen_range
kpp 3757134
Use ::gen_range to generate a random number in .. range
kpp b48c9a1
cargo fmt
kpp 821bb52
Fix multistream:encode_decode_message test
kpp 3e84211
Add a license to quickcheck-ext
kpp b0a8cda
Merge branch 'master' into rand08
kpp f695aac
More unsigned types for gen_range
kpp f79b939
Add T: Unsigned for gen_range
kpp 7cb1c80
More unsigned types for gen_range
kpp a3fa247
Merge branch 'master' into rand08
thomaseizinger 25f87c5
Fix build error
thomaseizinger 6a34f5c
Merge branch 'master' into rand08
kpp 49d2aa3
Bump versions and add changelog entries
kpp 1b08ba5
Apply suggestions from code review: CHANGELOG [unreleased]
kpp 17182b9
Bump versions and add changelog entries
kpp 8205887
Merge branch 'master' into rand08
kpp c4d6e6e
Make kad:closest tests deterministic
kpp e0d783e
Make kad:closest:disjoint:random_peers deterministic
kpp bc77431
Make kad:closest:disjoint tests deterministic
kpp aa5427e
::choose_multiple returns an iter instead of vec
kpp 5bd92fc
Make kad:disjoint:PeerVec::arbitrary deterministic
kpp a14caab
Merge branch 'master' into rand08
kpp fa17190
Merge branch 'master' into rand08
kpp 44e80e2
Fix kad:rand_distance test
kpp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [package] | ||
| name = "quickcheck-ext" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| publish = false | ||
| license = "Unlicense/MIT" | ||
|
|
||
| [dependencies] | ||
| quickcheck = "1" | ||
| num-traits = "0.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| pub use quickcheck::*; | ||
|
|
||
| use core::ops::Range; | ||
| use num_traits::sign::Unsigned; | ||
|
|
||
| pub trait GenRange { | ||
| fn gen_range<T: Unsigned + Arbitrary + Copy>(&mut self, _range: Range<T>) -> T; | ||
|
|
||
| fn gen_index(&mut self, ubound: usize) -> usize { | ||
| if ubound <= (core::u32::MAX as usize) { | ||
| self.gen_range(0..ubound as u32) as usize | ||
| } else { | ||
| self.gen_range(0..ubound) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl GenRange for Gen { | ||
| fn gen_range<T: Unsigned + Arbitrary + Copy>(&mut self, range: Range<T>) -> T { | ||
| <T as Arbitrary>::arbitrary(self) % (range.end - range.start) + range.start | ||
| } | ||
| } | ||
|
|
||
| pub trait SliceRandom { | ||
| fn shuffle<T>(&mut self, arr: &mut [T]); | ||
| fn choose_multiple<'a, T>( | ||
| &mut self, | ||
| arr: &'a [T], | ||
| amount: usize, | ||
| ) -> std::iter::Take<std::vec::IntoIter<&'a T>> { | ||
| let mut v: Vec<&T> = arr.iter().collect(); | ||
| self.shuffle(&mut v); | ||
| v.into_iter().take(amount) | ||
| } | ||
| } | ||
|
|
||
| impl SliceRandom for Gen { | ||
| fn shuffle<T>(&mut self, arr: &mut [T]) { | ||
| for i in (1..arr.len()).rev() { | ||
| // invariant: elements with index > i have been locked in place. | ||
| arr.swap(i, self.gen_index(i + 1)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.