-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a24a6e
commit d6ee968
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
alonzo/impl/test/test/Test/Cardano/Ledger/Alonzo/Golden.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{-# LANGUAGE TupleSections #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
-- | | ||
-- Module : Test.Cardano.Ledger.Mary.Golden | ||
-- Description : Golden Tests for the Mary era | ||
module Test.Cardano.Ledger.Alonzo.Golden | ||
( goldenUTxOEntryMinAda | ||
) | ||
where | ||
|
||
import Cardano.Ledger.Coin (Coin (..)) | ||
import Cardano.Ledger.Mary (MaryEra) | ||
import Cardano.Ledger.Mary.Value (AssetName (..), PolicyID (..), Value (..)) | ||
import Cardano.Ledger.ShelleyMA.Rules.Utxo (scaledMinDeposit) | ||
import Cardano.Ledger.ShelleyMA.Timelocks (Timelock (..)) | ||
import qualified Data.ByteString.Char8 as BS | ||
import Data.Char (chr) | ||
import qualified Data.Map.Strict as Map | ||
import qualified Data.Sequence.Strict as StrictSeq | ||
import Shelley.Spec.Ledger.Slot (SlotNo (..)) | ||
import Shelley.Spec.Ledger.Tx (hashScript) | ||
import Test.Cardano.Ledger.EraBuffet (StandardCrypto) | ||
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.HUnit (testCase, (@?=)) | ||
import Test.Cardano.Ledger.Mary.Golden | ||
|
||
goldenScaledMinDeposit :: TestTree | ||
goldenScaledMinDeposit = | ||
testGroup | ||
"golden tests - UTxOEntryMinAda" | ||
[ testCase "one policy, one (smallest) name, no datum hash" $ | ||
scaledMinDeposit | ||
( Value 1407406 $ | ||
Map.singleton pid1 (Map.fromList [(smallestName, 1)]) | ||
) | ||
minUTxO | ||
@?= Coin 1407406, | ||
testCase "one policy, one (smallest) name, yes datum hash" $ | ||
scaledMinDeposit | ||
( Value 1407406 $ | ||
Map.singleton pid1 (Map.fromList [(smallestName, 1)]) | ||
) | ||
minUTxO | ||
@?= Coin 1407406, | ||
testCase "one policy, one (small) name" $ | ||
scaledMinDeposit | ||
( Value 1444443 $ | ||
Map.singleton | ||
pid1 | ||
(Map.fromList [(smallName '1', 1)]) | ||
) | ||
minUTxO | ||
@?= Coin 1444443, | ||
testCase "one policy, three (small) name" $ | ||
scaledMinDeposit | ||
( Value 1555554 $ | ||
Map.singleton | ||
pid1 | ||
( Map.fromList | ||
[ (smallName '1', 1), | ||
(smallName '2', 1), | ||
(smallName '3', 1) | ||
] | ||
) | ||
) | ||
minUTxO | ||
@?= Coin 1555554, | ||
testCase "one policy, one (largest) name" $ | ||
scaledMinDeposit | ||
( Value 1555554 $ | ||
Map.singleton | ||
pid1 | ||
(Map.fromList [(largestName 'a', 1)]) | ||
) | ||
minUTxO | ||
@?= Coin 1555554, | ||
testCase "one policy, three (largest) name" $ | ||
scaledMinDeposit | ||
( Value 1962961 $ | ||
Map.singleton | ||
pid1 | ||
( Map.fromList | ||
[ (largestName 'a', 1), | ||
(largestName 'b', 1), | ||
(largestName 'c', 1) | ||
] | ||
) | ||
) | ||
minUTxO | ||
@?= Coin 1962961, | ||
testCase "two policies, one (smallest) name" $ | ||
scaledMinDeposit | ||
( Value 1592591 $ | ||
Map.fromList | ||
[ ( pid1, | ||
(Map.fromList [(smallestName, 1)]) | ||
), | ||
( pid2, | ||
(Map.fromList [(smallestName, 1)]) | ||
) | ||
] | ||
) | ||
minUTxO | ||
@?= Coin 1592591, | ||
testCase "two policies, two (small) names" $ | ||
scaledMinDeposit | ||
( Value 1629628 $ | ||
Map.fromList | ||
[ ( pid1, | ||
(Map.fromList [(smallName '1', 1)]) | ||
), | ||
( pid2, | ||
(Map.fromList [(smallName '2', 1)]) | ||
) | ||
] | ||
) | ||
minUTxO | ||
@?= Coin 1629628, | ||
testCase "three policies, ninety-six (small) names" $ | ||
scaledMinDeposit | ||
( Value 7407400 $ | ||
Map.fromList | ||
[ ( pid1, | ||
(Map.fromList $ map ((,1) . smallName . chr) [32 .. 63]) | ||
), | ||
( pid2, | ||
(Map.fromList $ map ((,1) . smallName . chr) [64 .. 95]) | ||
), | ||
( pid3, | ||
(Map.fromList $ map ((,1) . smallName . chr) [96 .. 127]) | ||
) | ||
] | ||
) | ||
minUTxO | ||
@?= Coin 7407400 | ||
] |