Skip to content

Commit

Permalink
Implement Message::get_data_strategy()
Browse files Browse the repository at this point in the history
A method that returns a proptest strategy that creates
`Message::GetData` instances.
  • Loading branch information
jvff committed Jul 6, 2021
1 parent 3f1ba69 commit 00c13b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zebra-network/src/protocol/external/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,11 @@ impl Message {
pub fn inv_strategy() -> BoxedStrategy<Self> {
any::<Vec<InventoryHash>>().prop_map(Message::Inv).boxed()
}

/// Create a strategy that only generates [`Message::GetData`] messages.
pub fn get_data_strategy() -> BoxedStrategy<Self> {
any::<Vec<InventoryHash>>()
.prop_map(Message::GetData)
.boxed()
}
}

0 comments on commit 00c13b6

Please sign in to comment.