mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +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
|
|
@ -279,7 +279,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
impl quickcheck::Arbitrary for TorrentScrapeStatistics {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
Self {
|
||||
seeders: NumberOfPeers(i32::arbitrary(g)),
|
||||
completed: NumberOfDownloads(i32::arbitrary(g)),
|
||||
|
|
@ -289,7 +289,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for ConnectResponse {
|
||||
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)),
|
||||
|
|
@ -298,7 +298,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for AnnounceResponse {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
let peers = (0..u8::arbitrary(g)).map(|_| {
|
||||
ResponsePeer::arbitrary(g)
|
||||
}).collect();
|
||||
|
|
@ -314,7 +314,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl quickcheck::Arbitrary for ScrapeResponse {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||
let torrent_stats = (0..u8::arbitrary(g)).map(|_| {
|
||||
TorrentScrapeStatistics::arbitrary(g)
|
||||
}).collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue