diff --git a/marlowe-contracts/test/Spec/Marlowe/Analysis.hs b/marlowe-contracts/test/Spec/Marlowe/Analysis.hs index 50a2958f5e..63e33e568e 100644 --- a/marlowe-contracts/test/Spec/Marlowe/Analysis.hs +++ b/marlowe-contracts/test/Spec/Marlowe/Analysis.hs @@ -29,7 +29,7 @@ tests = testGroup "Marlowe Contract" , testCase "Option test" optionTest ] -hasWarnings :: Maybe C.Contract -> IO Bool +hasWarnings :: Maybe (C.Contract Token) -> IO Bool hasWarnings (Just contract) = do result <- warningsTrace contract case result of diff --git a/marlowe-contracts/test/Spec/Marlowe/Contracts.hs b/marlowe-contracts/test/Spec/Marlowe/Contracts.hs index e4f160b8c4..0e9fa2cda3 100644 --- a/marlowe-contracts/test/Spec/Marlowe/Contracts.hs +++ b/marlowe-contracts/test/Spec/Marlowe/Contracts.hs @@ -53,10 +53,10 @@ tokSymbol = "" tok :: Token tok = Token tokSymbol tokName -tokValueOf :: Integer -> C.Money -tokValueOf = singleton tokSymbol tokName +tokValueOf :: Integer -> C.Money Token +tokValueOf = C.moneyFromValue . singleton tokSymbol tokName -assertTotalPayments :: Party -> [C.Payment] -> C.Money -> Assertion +assertTotalPayments :: Party -> [C.Payment Token] -> C.Money Token -> Assertion assertTotalPayments p t x = assertBool "total payments to party" (totalPayments t == x) where totalPayments = mconcat . map (\(C.Payment _ _ a) -> a) . filter (\(C.Payment _ a _) -> a == C.Party p) @@ -65,7 +65,7 @@ assertNoWarnings :: [a] -> Assertion assertNoWarnings [] = pure () assertNoWarnings t = assertBool "Assert no warnings" $ null t -assertClose :: C.Contract -> Assertion +assertClose :: C.Contract Token -> Assertion assertClose = assertBool "Contract is in Close" . (C.Close==) assertNoFailedTransactions :: C.TransactionError -> Assertion @@ -95,7 +95,7 @@ zeroCouponBondTest = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 90_000_000) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 90_000_000) C.Error err -> assertNoFailedTransactions err @@ -124,7 +124,7 @@ couponBondTest = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 92_000_000) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 92_000_000) C.Error err -> assertNoFailedTransactions err @@ -148,8 +148,8 @@ swapContractTest = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 10_000_000 <> tokValueOf 30) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 10_000_000 <> tokValueOf 30) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue (lovelaceValueOf 10_000_000) <> tokValueOf 30) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue (lovelaceValueOf 10_000_000) <> tokValueOf 30) C.Error err -> assertNoFailedTransactions err @@ -215,7 +215,7 @@ americanCallOptionExercisedTest = assertClose txOutContract assertNoWarnings txOutWarnings assertTotalPayments w1Pk txOutPayments (tokValueOf 30) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 10_000_000) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 10_000_000) C.Error err -> assertNoFailedTransactions err @@ -281,7 +281,7 @@ europeanCallOptionExercisedTest = assertClose txOutContract assertNoWarnings txOutWarnings assertTotalPayments w1Pk txOutPayments (tokValueOf 30) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 10_000_000) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 10_000_000) C.Error err -> assertNoFailedTransactions err @@ -319,8 +319,8 @@ futureNoChange = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings $ filter nonZeroPay txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 8_000_000) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 8_000_000) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 8_000_000) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 8_000_000) C.Error err -> assertNoFailedTransactions err where @@ -355,8 +355,8 @@ futureNoMarginCall = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 1_333_333) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 14_666_667) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 1_333_333) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 14_666_667) C.Error err -> assertNoFailedTransactions err @@ -395,8 +395,8 @@ futureWithMarginCall = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 61_333_333) - assertTotalPayments w2Pk txOutPayments (lovelaceValueOf 14_666_667) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 61_333_333) + assertTotalPayments w2Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 14_666_667) C.Error err -> assertNoFailedTransactions err @@ -458,6 +458,6 @@ reverseConvertibleTest = C.TransactionOutput {..} -> do assertClose txOutContract assertNoWarnings txOutWarnings - assertTotalPayments w1Pk txOutPayments (lovelaceValueOf 10_000_000) + assertTotalPayments w1Pk txOutPayments (C.moneyFromValue $ lovelaceValueOf 10_000_000) C.Error err -> assertNoFailedTransactions err