Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSandwich committed Jun 14, 2019
1 parent 4d0191d commit f5d654d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
20 changes: 20 additions & 0 deletions chain-impl-mockchain/src/ledger.rs
Expand Up @@ -828,3 +828,23 @@ fn input_account_verify(
}
}
}

#[cfg(test)]
pub mod test {
use super::*;
use crate::message::ConfigParams;
use quickcheck::{Arbitrary, Gen};
use quickcheck_macros::quickcheck;

#[quickcheck]
fn test_of_test(init_message: ArbitraryInitMessage) {}

#[derive(Clone, Debug)]
struct ArbitraryInitMessage(Message);

impl Arbitrary for ArbitraryInitMessage {
fn arbitrary<G: Gen>(gen: &mut G) -> Self {
ArbitraryInitMessage(Message::Initial(ConfigParams::arbitrary_all_params(gen)))
}
}
}
19 changes: 19 additions & 0 deletions chain-impl-mockchain/src/message/config.rs
Expand Up @@ -70,4 +70,23 @@ mod test {
)
}
}

impl ConfigParams {
pub fn arbitrary_all_params(g: &mut impl Gen) -> Self {
ConfigParams(vec![
ConfigParam::Block0Date(Arbitrary::arbitrary(g)),
ConfigParam::Discrimination(Arbitrary::arbitrary(g)),
ConfigParam::ConsensusVersion(Arbitrary::arbitrary(g)),
ConfigParam::SlotsPerEpoch(Arbitrary::arbitrary(g)),
ConfigParam::SlotDuration(Arbitrary::arbitrary(g)),
ConfigParam::ConsensusGenesisPraosActiveSlotsCoeff(Arbitrary::arbitrary(g)),
ConfigParam::MaxNumberOfTransactionsPerBlock(Arbitrary::arbitrary(g)),
ConfigParam::BftSlotsRatio(Arbitrary::arbitrary(g)),
ConfigParam::AddBftLeader(Arbitrary::arbitrary(g)),
ConfigParam::RemoveBftLeader(Arbitrary::arbitrary(g)),
ConfigParam::LinearFee(Arbitrary::arbitrary(g)),
ConfigParam::ProposalExpiration(Arbitrary::arbitrary(g)),
])
}
}
}

0 comments on commit f5d654d

Please sign in to comment.