Skip to content

Commit

Permalink
Used printf for some error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anteproperispomenon committed Aug 25, 2022
1 parent 92bf043 commit b3127f9
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions test/Spec/BotPlutusInterface/Balance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import Spec.MockContract (
)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (Assertion, assertBool, assertFailure, testCase, (@?=))
import Text.Printf (printf)
import Prelude

{- | Tests for 'cardano-cli query utxo' result parsers
Expand Down Expand Up @@ -239,13 +240,13 @@ dontAddChangeToDatum = do
(balScrUtxos, balOtherUtxos) = partition isScrUtxo (txOutputs trx)
assertBool
( "Expected UTxO not in output Tx."
<> "\nExpected UTxO: "
<> "\nExpected UTxO: \n"
<> show scrTxOutExpected
<> "\nBalanced Script UTxOs: "
<> "\nBalanced Script UTxOs: \n"
<> show balScrUtxos
<> "\nOther Balanced UTxOs: "
<> "\nOther Balanced UTxOs: \n"
<> show balOtherUtxos
<> "\nUnbalanced UTxOs: "
<> "\nUnbalanced UTxOs: \n"
<> show (txOutputs (unbalancedTx ^. OffChain.tx))
)
(scrTxOutExpected `elem` txOutputs trx)
Expand Down Expand Up @@ -306,13 +307,13 @@ dontAddChangeToDatum2 = do
-- is in the output.
assertBool
( "Expected UTxO not in output Tx."
<> "\nExpected UTxO: "
<> "\nExpected UTxO: \n"
<> show scrTxOutExpected
<> "\nBalanced Script UTxOs: "
<> "\nBalanced Script UTxOs: \n"
<> show balScrUtxos
<> "\nOther Balanced UTxOs: "
<> "\nOther Balanced UTxOs: \n"
<> show balOtherUtxos
<> "\nUnbalanced UTxOs: "
<> "\nUnbalanced UTxOs: \n"
<> show (txOutputs (unbalancedTx ^. OffChain.tx))
)
(scrTxOutExpected `elem` txOutputs trx)
Expand All @@ -331,23 +332,15 @@ dontAddChangeToDatum2 = do
-- Check for ADA change
assertBool
( "Other UTxOs do not contain expected ADA change."
<> "\nExpected Amount : "
<> show adaChange
<> " Lovelace"
<> "\nActual Amount : "
<> show (lovelaceInValue remainingValue)
<> " Lovelace"
<> printf "\nExpected Amount : %d Lovelace" adaChange
<> printf "\nActual Amount : %d Lovelace" (lovelaceInValue remainingValue)
)
(adaChange == lovelaceInValue remainingValue)
-- Check for Token change
assertBool
( "Other UTxOs do not contain expected Token change."
<> "\nExpected Amount : "
<> show tokChange
<> " tokens"
<> "\nActual Amount : "
<> show (acValueOf tokenAsset remainingValue)
<> " tokens"
<> printf "\nExpected Amount : %d tokens" tokChange
<> printf "\nActual Amount : %d tokens" (acValueOf tokenAsset remainingValue)
)
(tokChange == acValueOf tokenAsset remainingValue)

Expand Down

0 comments on commit b3127f9

Please sign in to comment.