-
Notifications
You must be signed in to change notification settings - Fork 155
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
Showing
18 changed files
with
193 additions
and
51 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
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
23 changes: 23 additions & 0 deletions
23
eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Imp.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,23 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
module Test.Cardano.Ledger.Allegra.Imp (spec) where | ||
|
||
import Cardano.Ledger.Core | ||
import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure, ShelleyUtxowPredFailure) | ||
import Test.Cardano.Ledger.Common | ||
import Test.Cardano.Ledger.Shelley.ImpTest (ShelleyEraImp) | ||
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp | ||
|
||
spec :: | ||
forall era. | ||
( ShelleyEraImp era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era | ||
) => | ||
Spec | ||
spec = do | ||
ShelleyImp.spec @era |
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
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
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
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
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
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
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
24 changes: 24 additions & 0 deletions
24
eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Imp.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,24 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Test.Cardano.Ledger.Babbage.Imp (spec) where | ||
|
||
import Cardano.Ledger.Babbage.Core | ||
import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure, ShelleyUtxowPredFailure) | ||
import qualified Test.Cardano.Ledger.Alonzo.Imp as AlonzoImp | ||
import Test.Cardano.Ledger.Alonzo.ImpTest (AlonzoEraImp) | ||
import Test.Cardano.Ledger.Common | ||
|
||
spec :: | ||
forall era. | ||
( AlonzoEraImp era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era | ||
) => | ||
Spec | ||
spec = do | ||
AlonzoImp.spec @era |
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
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
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
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,28 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Test.Cardano.Ledger.Mary.Imp (spec) where | ||
|
||
import Cardano.Ledger.Mary.Core | ||
import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure, ShelleyUtxowPredFailure) | ||
import qualified Test.Cardano.Ledger.Allegra.Imp as AllegraImp | ||
import Test.Cardano.Ledger.Common | ||
import qualified Test.Cardano.Ledger.Mary.Imp.UtxoSpec as Utxo | ||
import Test.Cardano.Ledger.Mary.ImpTest (MaryEraImp) | ||
import Test.Cardano.Ledger.Shelley.ImpTest (withImpState) | ||
|
||
spec :: | ||
forall era. | ||
( MaryEraImp era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era | ||
, InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era | ||
) => | ||
Spec | ||
spec = do | ||
AllegraImp.spec @era | ||
describe "MaryImpSpec" $ withImpState @era $ do | ||
Utxo.spec @era |
40 changes: 40 additions & 0 deletions
40
eras/mary/impl/testlib/Test/Cardano/Ledger/Mary/Imp/UtxoSpec.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,40 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE OverloadedLists #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Test.Cardano.Ledger.Mary.Imp.UtxoSpec (spec) where | ||
|
||
import Cardano.Ledger.Allegra.Scripts | ||
import Cardano.Ledger.Coin (Coin (..)) | ||
import Cardano.Ledger.Mary.Core | ||
import Cardano.Ledger.Mary.Value | ||
--import Cardano.Ledger.Shelley.Rules (ShelleyUtxoPredFailure (..)) | ||
import qualified Data.Map.Strict as Map | ||
import Lens.Micro | ||
import Test.Cardano.Ledger.Imp.Common | ||
import Test.Cardano.Ledger.Shelley.ImpTest | ||
|
||
spec :: | ||
( ShelleyEraImp era | ||
, MaryEraTxBody era | ||
--, InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era | ||
, NativeScript era ~ Timelock era | ||
, Value era ~ MaryValue (EraCrypto era) | ||
) => | ||
SpecWith (ImpTestState era) | ||
spec = describe "UTXO" $ do | ||
it "Mint a Token" $ do | ||
(_, addr) <- freshKeyAddr | ||
(keyHash, _) <- freshKeyPair | ||
scriptHash <- impAddNativeScript $ RequireSignature keyHash | ||
let txCoin = Coin 1000000 | ||
txAsset = MultiAsset $ Map.singleton (PolicyID scriptHash) $ Map.singleton (AssetName "testAsset") 100 | ||
txValue = MaryValue txCoin txAsset | ||
txBody = | ||
mkBasicTxBody | ||
& outputsTxBodyL .~ [mkBasicTxOut addr txValue] | ||
& mintTxBodyL .~ txAsset | ||
submitTx_ $ mkBasicTx txBody |
Oops, something went wrong.