{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}

module Main where

import Cardano.Ledger.Conway (Conway)
import Cardano.Ledger.Core
import qualified Test.Cardano.Ledger.Api.State.Imp.QuerySpec as ImpQuery (spec)
import qualified Test.Cardano.Ledger.Api.State.QuerySpec as StateQuery (spec)
import qualified Test.Cardano.Ledger.Api.Tx as Tx (spec)
import qualified Test.Cardano.Ledger.Api.Tx.Body as TxBody (spec)
import qualified Test.Cardano.Ledger.Api.Tx.Out as TxOut (spec)
import Test.Cardano.Ledger.Imp.Common
import Test.Cardano.Ledger.Shelley.ImpTest (LedgerSpec, modifyImpInitProtVer)

-- ====================================================================================

apiSpec :: Spec
apiSpec :: Spec
apiSpec =
  forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"cardano-ledger-api" forall a b. (a -> b) -> a -> b
$ do
    forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Tx" forall a b. (a -> b) -> a -> b
$ do
      Spec
Tx.spec
      Spec
TxOut.spec
      Spec
TxBody.spec
    forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"State" forall a b. (a -> b) -> a -> b
$ do
      Spec
StateQuery.spec
    forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Imp" forall a b. (a -> b) -> a -> b
$
      forall t. ImpSpec t => SpecWith (ImpInit t) -> Spec
withImpInit @(LedgerSpec Conway) forall a b. (a -> b) -> a -> b
$
        forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ (forall era. Era era => [Version]
eraProtVersions @Conway) forall a b. (a -> b) -> a -> b
$ \Version
v ->
          forall era.
ShelleyEraImp era =>
Version
-> SpecWith (ImpInit (LedgerSpec era))
-> SpecWith (ImpInit (LedgerSpec era))
modifyImpInitProtVer Version
v forall a b. (a -> b) -> a -> b
$ do
            forall era. ConwayEraImp era => SpecWith (ImpInit (LedgerSpec era))
ImpQuery.spec @Conway

main :: IO ()
IO ()
main = Spec -> IO ()
ledgerTestMain Spec
apiSpec