Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mueller committed Feb 14, 2019
1 parent d1347f6 commit 9f494d5
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -63,11 +63,11 @@ gameSpec =
it "should unlock the funds" $
evaluate gameEvalSuccess >>=
(`shouldSatisfy` hasFundsDistribution
[(Wallet 1, Ada.adaValueOf 12), (Wallet 2, Ada.adaValueOf 8)])
[(Wallet 1, Ada.fromInt 12), (Wallet 2, Ada.fromInt 8)])
it "should keep the funds" $
evaluate gameEvalFailure >>=
(`shouldSatisfy` hasFundsDistribution
[(Wallet 1, ten), (Wallet 2, Ada.adaValueOf 8)])
[(Wallet 1, ten), (Wallet 2, Ada.fromInt 8)])
it
"Sequential fund transfer fails - 'Game' script - 'payToPublicKey_' action" $
evaluate payAll >>=
Expand All @@ -77,7 +77,7 @@ gameSpec =
, (Wallet 3, ten)
])
where
ten = Ada.adaValueOf 10
ten = Ada.fromInt 10
gameEvalFailure =
Evaluation
[(Wallet 1, 10), (Wallet 2, 10)]
Expand Down Expand Up @@ -132,8 +132,8 @@ gameSpec =
slotRange = JSON.String "{\"ivTo\":null,\"ivFrom\":null}"

hasFundsDistribution ::
[(Wallet, Value)]
-> Either PlaygroundError (Blockchain, [EmulatorEvent], [(Wallet, Value)])
[(Wallet, Ada.ADa)]
-> Either PlaygroundError (Blockchain, [EmulatorEvent], [(Wallet, Ada.Ada)])
-> Bool
hasFundsDistribution _ (Left _) = False
hasFundsDistribution requiredDistribution (Right (_, _, actualDistribution)) =
Expand All @@ -151,7 +151,7 @@ crowdfundingSpec =
it "should run successful campaign" $
evaluate successfulCampaign >>=
(`shouldSatisfy` hasFundsDistribution
[(Wallet 1, Ada.adaValueOf 26), (Wallet 2, Ada.adaValueOf 2), (Wallet 3, Ada.adaValueOf 2)])
[(Wallet 1, Ada.fromInt 26), (Wallet 2, Ada.fromInt 2), (Wallet 3, Ada.fromInt 2)])
it "should run failed campaign" $
evaluate failedCampaign >>=
(`shouldSatisfy` hasFundsDistribution
Expand All @@ -160,7 +160,7 @@ crowdfundingSpec =
, (Wallet 3, ten)
])
where
ten = Ada.adaValueOf 10
ten = Ada.fromInt 10
failedCampaign =
Evaluation
[(Wallet 1, 10), (Wallet 2, 10), (Wallet 3, 10)]
Expand Down Expand Up @@ -208,5 +208,5 @@ evaluate ::
Evaluation
-> IO (Either PlaygroundError ( Blockchain
, [EmulatorEvent]
, [(Wallet, Value)]))
, [(Wallet, Ada.Ada)]))
evaluate evaluation = runExceptT $ PI.runFunction evaluation

0 comments on commit 9f494d5

Please sign in to comment.