Skip to content
Permalink
Browse files

WIP

  • Loading branch information...
CodeSandwich committed Jun 11, 2019
1 parent 4d0191d commit f5d654dc20313cdd9673326f1daa6f3c55465a7d
Showing with 39 additions and 0 deletions.
  1. +20 −0 chain-impl-mockchain/src/ledger.rs
  2. +19 −0 chain-impl-mockchain/src/message/config.rs
@@ -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)))
}
}
}
@@ -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.
You can’t perform that action at this time.