Skip to content

Commit 37ccb96

Browse files
committed
test(standing_bid): add property tests for MoveToHydra redeemer
1 parent 57e8fc4 commit 37ccb96

File tree

2 files changed

+223
-36
lines changed

2 files changed

+223
-36
lines changed

test/Spec/HydraAuctionOnchain/QuickCheck/Gen.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module Spec.HydraAuctionOnchain.QuickCheck.Gen
44
( KeyPair (..)
55
, genKeyPair
6+
, genScriptAddress
67
, genTxInfoTemplate
78
, genValidAuctionTerms
89
, genValidBidState
@@ -19,10 +20,13 @@ import Plutarch.Test.QuickCheck.Instances ()
1920
import PlutusLedgerApi.V1.Interval qualified as Interval (always)
2021
import PlutusLedgerApi.V1.Value qualified as Value (singleton)
2122
import PlutusLedgerApi.V2
22-
( BuiltinByteString
23+
( Address (Address)
24+
, BuiltinByteString
25+
, Credential (ScriptCredential)
2326
, CurrencySymbol
2427
, POSIXTime (POSIXTime)
2528
, PubKeyHash
29+
, ScriptHash
2630
, TxId
2731
, TxInfo (..)
2832
, adaSymbol
@@ -64,6 +68,9 @@ genKeyPair =
6468
genIntegerGreaterThan :: Integer -> Gen Integer
6569
genIntegerGreaterThan a = arbitrary @(Positive Integer) <&> \(Positive b) -> a + b
6670

71+
genScriptAddress :: Gen Address
72+
genScriptAddress = flip Address Nothing . ScriptCredential <$> arbitrary @ScriptHash
73+
6774
genTxInfoTemplate :: Gen TxInfo
6875
genTxInfoTemplate = do
6976
txInfoFeeAda <- arbitrary @Integer
@@ -149,7 +156,7 @@ genValidAuctionTerms :: PublicKey -> Gen AuctionTerms
149156
genValidAuctionTerms vkey = do
150157
GenNonAdaValue @Positive at'AuctionLot <- arbitrary
151158
let (at'SellerVk, at'SellerPkh) = hashVerificationKey vkey
152-
at'Delegates <- vector @PubKeyHash =<< chooseInt (0, 10)
159+
at'Delegates <- vector @PubKeyHash =<< chooseInt (1, 10)
153160

154161
let chooseInterval = POSIXTime <$> chooseInteger (1, 604_800_000) -- up to 1 week in msec
155162
(biddingPeriod, purchasePeriod, penaltyPeriod) <-

0 commit comments

Comments
 (0)