{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

module Test.Cardano.Ledger.Mary.Imp (spec, Allegra.shelleyToBabbageSpec, maryOnlySpec) where

import Cardano.Ledger.Core
import Cardano.Ledger.Mary
import qualified Cardano.Ledger.Shelley.Rules as Shelley
import Control.State.Transition (Event)
import Data.Proxy (Proxy (..))
import qualified Test.Cardano.Ledger.Allegra.Imp as Allegra
import Test.Cardano.Ledger.Imp.Common
import qualified Test.Cardano.Ledger.Mary.Imp.UtxoSpec as UTXO
import Test.Cardano.Ledger.Mary.ImpTest

spec ::
  ( MaryEraImp era
  , Event (EraRule "RUPD" era) ~ Shelley.RupdEvent
  ) =>
  proxy era ->
  Spec
spec :: forall era (proxy :: * -> *).
(MaryEraImp era, Event (EraRule "RUPD" era) ~ RupdEvent) =>
proxy era -> Spec
spec proxy era
era = do
  proxy era -> Spec
forall era (proxy :: * -> *).
(AllegraEraImp era, Event (EraRule "RUPD" era) ~ RupdEvent) =>
proxy era -> Spec
Allegra.spec proxy era
era
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"MaryEra Onwards" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$
    proxy era -> SpecWith (ImpInit (LedgerSpec era)) -> Spec
forall (proxy :: * -> *) era.
ShelleyEraImp era =>
proxy era -> SpecWith (ImpInit (LedgerSpec era)) -> Spec
withImpInitEachEraVersion proxy era
era (SpecWith (ImpInit (LedgerSpec era)) -> Spec)
-> SpecWith (ImpInit (LedgerSpec era)) -> Spec
forall a b. (a -> b) -> a -> b
$ do
      UTXO.spec

maryOnlySpec :: Spec
maryOnlySpec :: Spec
maryOnlySpec =
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"MaryEra Specific" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ Proxy MaryEra -> SpecWith (ImpInit (LedgerSpec MaryEra)) -> Spec
forall (proxy :: * -> *) era.
ShelleyEraImp era =>
proxy era -> SpecWith (ImpInit (LedgerSpec era)) -> Spec
withImpInitEachEraVersion (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @MaryEra) (SpecWith (ImpInit (LedgerSpec MaryEra)) -> Spec)
-> SpecWith (ImpInit (LedgerSpec MaryEra)) -> Spec
forall a b. (a -> b) -> a -> b
$ do
    UTXO.maryOnlySpec