Work on treasury validator tests
This commit is contained in:
parent
75471d0058
commit
7ac5ac5af5
1 changed files with 17 additions and 5 deletions
|
|
@ -23,7 +23,13 @@ import Apropos (
|
||||||
)
|
)
|
||||||
import Apropos.Script (HasScriptRunner (expect, runScriptTestsWhere, script))
|
import Apropos.Script (HasScriptRunner (expect, runScriptTestsWhere, script))
|
||||||
import Data.Set (Set)
|
import Data.Set (Set)
|
||||||
import Plutus.V1.Ledger.Api (CurrencySymbol, ScriptContext)
|
import Plutus.V1.Ledger.Api (
|
||||||
|
CurrencySymbol,
|
||||||
|
ScriptContext (scriptContextPurpose, scriptContextTxInfo),
|
||||||
|
ScriptPurpose (Minting),
|
||||||
|
TxInfo (txInfoMint),
|
||||||
|
Value,
|
||||||
|
)
|
||||||
import Test.Tasty (TestTree, testGroup)
|
import Test.Tasty (TestTree, testGroup)
|
||||||
import Test.Tasty.Hedgehog (fromGroup)
|
import Test.Tasty.Hedgehog (fromGroup)
|
||||||
|
|
||||||
|
|
@ -44,6 +50,7 @@ data TreasuryTxProp
|
||||||
| GATIsNotBurned
|
| GATIsNotBurned
|
||||||
| AllGATsValid
|
| AllGATsValid
|
||||||
| SomeGATsInvalid
|
| SomeGATsInvalid
|
||||||
|
| ScriptPurposeIsNotMinting
|
||||||
deriving stock (Show, Eq, Ord, Enum, Bounded)
|
deriving stock (Show, Eq, Ord, Enum, Bounded)
|
||||||
|
|
||||||
data TreasuryTxModel = TreasuryTxModel
|
data TreasuryTxModel = TreasuryTxModel
|
||||||
|
|
@ -63,10 +70,15 @@ instance LogicalModel TreasuryTxProp where
|
||||||
|
|
||||||
instance HasLogicalModel TreasuryTxProp TreasuryTxModel where
|
instance HasLogicalModel TreasuryTxProp TreasuryTxModel where
|
||||||
satisfiesProperty :: TreasuryTxProp -> TreasuryTxModel -> Bool
|
satisfiesProperty :: TreasuryTxProp -> TreasuryTxModel -> Bool
|
||||||
satisfiesProperty GATIsBurned trModel = undefined
|
satisfiesProperty prop model =
|
||||||
satisfiesProperty GATIsNotBurned trModel = undefined
|
let purpose = model.ctx.scriptContextPurpose :: ScriptPurpose
|
||||||
satisfiesProperty AllGATsValid trModel = undefined
|
txInfo = model.ctx.scriptContextTxInfo :: TxInfo
|
||||||
satisfiesProperty SomeGATsInvalid trModel = undefined
|
amountMinted = txInfo.txInfoMint :: Value
|
||||||
|
in case prop of
|
||||||
|
ScriptPurposeIsNotMinting -> case purpose of
|
||||||
|
Minting _ -> False
|
||||||
|
_ -> True
|
||||||
|
_ -> undefined
|
||||||
|
|
||||||
-- instance HasParameterisedGenerator TreasuryTxProp Int where
|
-- instance HasParameterisedGenerator TreasuryTxProp Int where
|
||||||
-- parameterisedGenerator :: Set TreasuryTxProp -> Gen Int
|
-- parameterisedGenerator :: Set TreasuryTxProp -> Gen Int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue