Skip to content

Commit

Permalink
Add missing generators for 'GenTxId' and 'MempoolSizeAndCapacity'
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Jan 18, 2022
1 parent 7316a2c commit 97c456f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion server/test/unit/Test/Generators.hs
Expand Up @@ -17,7 +17,7 @@ import Cardano.Ledger.Keys
import Cardano.Ledger.Serialization
( ToCBORGroup )
import Cardano.Network.Protocol.NodeToClient
( Block )
( Block, GenTxId )
import Cardano.Slotting.Slot
( EpochNo (..) )
import Cardano.Slotting.Time
Expand All @@ -44,6 +44,7 @@ import Ouroboros.Consensus.Cardano.Block
, HardForkBlock (..)
, MaryEra
, ShelleyEra
, TxId (..)
)
import Ouroboros.Consensus.HardFork.Combinator
( LedgerEraInfo (..), Mismatch (..), MismatchEraInfo (..), singleEraInfo )
Expand All @@ -57,12 +58,16 @@ import Ouroboros.Consensus.Shelley.Ledger.Block
( ShelleyBlock (..) )
import Ouroboros.Consensus.Shelley.Ledger.Config
( CompactGenesis, compactGenesis )
import Ouroboros.Consensus.Shelley.Ledger.Mempool
( TxId (..) )
import Ouroboros.Consensus.Shelley.Ledger.Query
( NonMyopicMemberRewards (..) )
import Ouroboros.Network.Block
( BlockNo (..), HeaderHash, Point (..), SlotNo (..), Tip (..) )
import Ouroboros.Network.Protocol.LocalStateQuery.Type
( AcquireFailure (..) )
import Ouroboros.Network.Protocol.LocalTxMonitor.Type
( MempoolSizeAndCapacity (..) )
import Ouroboros.Network.Protocol.LocalTxSubmission.Type
( SubmitResult (..) )
import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes
Expand Down Expand Up @@ -115,6 +120,16 @@ genBlock = reasonablySized $ oneof
<$> (Ledger.Block <$> arbitrary <*> (toTxSeq @era <$> arbitrary))
<*> arbitrary

genTxId :: Gen (GenTxId Block)
genTxId =
GenTxIdAlonzo . ShelleyTxId <$> arbitrary

genMempoolSizeAndCapacity :: Gen MempoolSizeAndCapacity
genMempoolSizeAndCapacity = MempoolSizeAndCapacity
<$> arbitrary
<*> arbitrary
<*> arbitrary

genWithOrigin :: Gen a -> Gen (Point.WithOrigin a)
genWithOrigin genA = frequency
[ (1, pure Point.Origin)
Expand Down

0 comments on commit 97c456f

Please sign in to comment.