Skip to content

Commit b55a7d2

Browse files
author
Luka Kurnjek
committed
Updating test for homework 5.
1 parent 0dfe502 commit b55a7d2

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

code/Week05/tests/THomework.hs

+17-16
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ goodCases = [ Case 0 0 10000 9000 9000 10000
4949
wrongSigner :: [Case]
5050
wrongSigner = [ Case 0 1 10000 9000 9000 10000
5151
, Case 0 2 10000 9000 9000 10000
52-
, Case 1 2 10000 9000 9000 10000
52+
, Case 1 0 10000 9000 9000 10000
5353
, Case 1 2 10000 9000 9000 10000
5454
, Case 2 0 10000 9000 9000 10000
5555
, Case 2 1 10000 9000 9000 10000
@@ -113,8 +113,8 @@ mintingTx tp val pkh =
113113
]
114114

115115

116-
script2 :: TxOutRef -> TokenName -> HomeworkScript
117-
script2 txOutRef tn = TypedPolicy $ toV2 $ H2.nftPolicy txOutRef tn
116+
script2 :: TxOutRef -> HomeworkScript
117+
script2 txOutRef = TypedPolicy $ toV2 $ H2.nftPolicy txOutRef
118118

119119
homework2 :: MockConfig -> TestTree
120120
homework2 cfg = do
@@ -149,7 +149,7 @@ changeSigner sig = do
149149

150150
utxos <- utxoAt beneficiary
151151
let [(ref, out)] = utxos
152-
typedPolicy = script2 ref ""
152+
typedPolicy = script2 ref
153153
mintingValue = singleton (scriptCurrencySymbol typedPolicy) "" 1
154154
valueInOutput = txOutValue out
155155
checkBalance (owns beneficiary mintingValue) $ do
@@ -162,7 +162,7 @@ changeAmount amt = do
162162

163163
utxos <- utxoAt beneficiary
164164
let [(ref, out)] = utxos
165-
typedPolicy = script2 ref ""
165+
typedPolicy = script2 ref
166166
mintingValue = singleton (scriptCurrencySymbol typedPolicy) "" amt
167167
valueInOutput = txOutValue out
168168
checkBalance (owns beneficiary mintingValue) $ do
@@ -175,7 +175,7 @@ changeTokenName tn = do
175175

176176
utxos <- utxoAt beneficiary
177177
let [(ref, out)] = utxos
178-
typedPolicy = script2 ref ""
178+
typedPolicy = script2 ref
179179
mintingValue = singleton (scriptCurrencySymbol typedPolicy) tn 1
180180
valueInOutput = txOutValue out
181181
checkBalance (owns beneficiary mintingValue) $ do
@@ -190,9 +190,9 @@ changeCurrencySymbol u = do
190190
utxos <- utxoAt beneficiary
191191
wrongUtxos <- utxoAt user
192192
let [(ref, out)] = utxos
193-
[(wRef, wOut)] = wrongUtxos
194-
typedPolicy = script2 ref ""
195-
wrongTypedPolicy = script2 wRef ""
193+
[(wRef, _)] = wrongUtxos
194+
typedPolicy = script2 ref
195+
wrongTypedPolicy = script2 wRef
196196
wrongMintingValue = singleton (scriptCurrencySymbol wrongTypedPolicy) "" 1
197197
valueInOutput = txOutValue out
198198
checkBalance (owns beneficiary wrongMintingValue) $ do
@@ -202,12 +202,12 @@ comsumeAnotherUTxO :: Run ()
202202
comsumeAnotherUTxO = do
203203
user <- newUser $ ada $ Lovelace 1000
204204
utxos <- utxoAt user
205-
let [(ref, out)] = utxos
205+
let [(ref, _)] = utxos
206206
submitTx user $ splitUTxOTx user ref
207207
utxos' <- utxoAt user
208208
case utxos' of
209-
[(ref',out'),(wRef,wOut)] -> do
210-
let typedPolicy = script2 ref' ""
209+
[(ref',out'),(wRef,_)] -> do
210+
let typedPolicy = script2 ref'
211211
mintingValue = singleton (scriptCurrencySymbol typedPolicy) "" 1
212212
valueInOutput = txOutValue out'
213213
submitTx user $ mintingNFTTx wRef typedPolicy mintingValue valueInOutput user
@@ -217,13 +217,13 @@ twoNFTs :: Run ()
217217
twoNFTs = do
218218
user <- newUser $ ada $ Lovelace 1000
219219
utxos <- utxoAt user
220-
let [(ref, out)] = utxos
220+
let [(ref, _)] = utxos
221221
submitTx user $ splitUTxOTx user ref
222222
utxos' <- utxoAt user
223223
case utxos' of
224224
[(ref1,out1),(ref2,out2)] -> do
225-
let typedPolicy1 = script2 ref1 ""
226-
typedPolicy2 = script2 ref2 ""
225+
let typedPolicy1 = script2 ref1
226+
typedPolicy2 = script2 ref2
227227
mintingValue1 = singleton (scriptCurrencySymbol typedPolicy1) "" 1
228228
mintingValue2 = singleton (scriptCurrencySymbol typedPolicy2) "" 1
229229
valueInOutput1 = txOutValue out1
@@ -245,4 +245,5 @@ splitUTxOTx pkh txOutRef= mconcat
245245
[ payToKey pkh (ada (Lovelace 500))
246246
, payToKey pkh (ada (Lovelace 500))
247247
, spendPubKey txOutRef
248-
]
248+
]
249+

0 commit comments

Comments
 (0)