Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ module Test.Gen.Cardano.Api.Typed
, genBlockHeader
, genBlockHeaderAt
, genBlockHeaderHash
, genChainPointAt
, genChainPoint
)
where

Expand Down Expand Up @@ -1520,3 +1522,16 @@ genBlockHeaderHash =
<> " with error "
<> show e
Right h -> h

-- | Generate a chain point with a likely invalid block header hash.
genChainPoint :: Gen ChainPoint
genChainPoint =
Gen.frequency
[ (1, pure ChainPointAtGenesis)
, (5, Q.arbitrary >>= genChainPointAt . SlotNo)
]

-- | Generate a chain point at given slot with a likely invalid block header hash.
genChainPointAt :: SlotNo -> Gen ChainPoint
genChainPointAt s =
ChainPoint s <$> genBlockHeaderHash
Loading