Revert "Add some simple proptests using the Arbitray trait on Requests and Responses, gated to test only"

This reverts commit 5a123acf56.
This commit is contained in:
Deirdre Connolly 2019-11-26 19:18:04 -05:00 committed by Deirdre Connolly
parent 6f52fc7773
commit 8a9a5ba29b
3 changed files with 0 additions and 39 deletions

View File

@ -17,8 +17,6 @@ hex = "0.4"
# which we don't use, so disable it to drop the dependencies.
indexmap = { version = "1.2", default-features = false }
pin-project = "0.4"
proptest = "0.9"
proptest-derive = "0.1.0"
rand = "0.7"
serde = { version = "1", features = ["serde_derive"] }
thiserror = "1"

View File

@ -1,8 +0,0 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc fb728d0d2a16976de785ed8525cc74c4d3f7826f8840ebe5a4fee6b5ab0edad8 # shrinks to req = GetMempool
cc 3ed95f3a436a15e33b27f4bf1105629860b8e6a895165eb83befcb625e951b1d # shrinks to req = GetPeers

View File

@ -6,9 +6,6 @@
use std::error::Error;
#[cfg(test)]
use proptest_derive::Arbitrary;
use zebra_chain::transaction::Transaction;
use crate::meta_addr::MetaAddr;
@ -17,18 +14,15 @@ use super::types::Nonce;
/// A network request, represented in internal format.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(test, derive(Arbitrary))]
pub enum Request {
/// Requests additional peers from the server.
GetPeers,
/// Advertises peers to the remote server.
#[cfg_attr(test, proptest(skip))]
PushPeers(Vec<MetaAddr>),
/// Heartbeats triggered on peer connection start.
// This is included as a bit of a hack, it should only be used
// internally for connection management. You should not expect to
// be firing or handling `Ping` requests or `Pong` responses.
#[cfg_attr(test, proptest(skip))]
Ping(Nonce),
/// Requests the transactions the remote server has verified but
/// not yet confirmed.
@ -37,17 +31,14 @@ pub enum Request {
/// A response to a network request, represented in internal format.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(test, derive(Arbitrary))]
pub enum Response {
/// Generic success.
Ok,
/// Generic error.
Error,
/// A list of peers, used to respond to `GetPeers`.
#[cfg_attr(test, proptest(skip))]
Peers(Vec<MetaAddr>),
/// A list of transactions, such as in response to `GetMempool`.
#[cfg_attr(test, proptest(skip))]
Transactions(Vec<Transaction>),
}
@ -59,23 +50,3 @@ where
Self::Error
}
}
#[cfg(test)]
mod test {
use proptest::prelude::*;
use super::{Request, Response};
proptest! {
#[test]
fn proptest_request(req in any::<Request>()) {
println!("{:?}", req);
}
#[test]
fn proptest_response(res in any::<Response>()) {
println!("{:?}", res);
}
}
}