{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Mary.Imp (spec) where

import Cardano.Ledger.Mary (MaryEra)
import Cardano.Ledger.Mary.Core
import Cardano.Ledger.Shelley.Rules (
  ShelleyPoolPredFailure,
  ShelleyUtxoPredFailure,
  ShelleyUtxowPredFailure,
 )
import qualified Test.Cardano.Ledger.Allegra.Imp as AllegraImp
import Test.Cardano.Ledger.Imp.Common
import qualified Test.Cardano.Ledger.Mary.Imp.UtxoSpec as Utxo
import Test.Cardano.Ledger.Mary.ImpTest
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp

spec ::
  forall era.
  ( MaryEraImp era
  , EraSpecificSpec era
  , InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era
  , InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era
  , InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era
  ) =>
  Spec
spec :: forall era.
(MaryEraImp era, EraSpecificSpec era,
 InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era,
 InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era,
 InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era) =>
Spec
spec = do
  forall era.
(ShelleyEraImp era, EraSpecificSpec era,
 InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era,
 InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era,
 InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era) =>
Spec
AllegraImp.spec @era
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"MaryImpSpec" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$
    forall era.
ShelleyEraImp era =>
SpecWith (ImpInit (LedgerSpec era)) -> Spec
withEachEraVersion @era (SpecWith (ImpInit (LedgerSpec era)) -> Spec)
-> SpecWith (ImpInit (LedgerSpec era)) -> Spec
forall a b. (a -> b) -> a -> b
$
      SpecWith (ImpInit (LedgerSpec era))
forall era.
(HasCallStack, MaryEraImp era,
 InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era) =>
SpecWith (ImpInit (LedgerSpec era))
Utxo.spec

instance EraSpecificSpec MaryEra where
  eraSpecificSpec :: SpecWith (ImpInit (LedgerSpec MaryEra))
eraSpecificSpec = SpecWith (ImpInit (LedgerSpec MaryEra))
forall era.
(ShelleyEraImp era, ShelleyEraTxCert era,
 InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era) =>
SpecWith (ImpInit (LedgerSpec era))
ShelleyImp.shelleyEraSpecificSpec