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 8b94baf commit 494460b
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 @@ -91,4 +91,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 494460b

Please sign in to comment.