mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
Upgrade quickcheck to 1.0, adjust code, optimizing a slow test
This commit is contained in:
parent
72ff55ae5d
commit
f9626ade57
19 changed files with 78 additions and 74 deletions
|
|
@ -292,7 +292,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
impl quickcheck::Arbitrary for AnnounceEvent {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
match (bool::arbitrary(g), bool::arbitrary(g)){
|
||||
(false, false) => Self::Started,
|
||||
(true, false) => Self::Started,
|
||||
|
|
@ -303,7 +303,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for ConnectRequest {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
Self {
|
||||
transaction_id: TransactionId(i32::arbitrary(g)),
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for AnnounceRequest {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
Self {
|
||||
connection_id: ConnectionId(i64::arbitrary(g)),
|
||||
transaction_id: TransactionId(i32::arbitrary(g)),
|
||||
|
|
@ -330,7 +330,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for ScrapeRequest {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
let info_hashes = (0..u8::arbitrary(g)).map(|_| {
|
||||
InfoHash::arbitrary(g)
|
||||
}).collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue