{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Main where

import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.Rules (AlonzoLEDGER)
import Data.Proxy (Proxy (..))
import System.Environment (lookupEnv)
import qualified Test.Cardano.Ledger.Alonzo.ChainTrace as ChainTrace
import qualified Test.Cardano.Ledger.Alonzo.Golden as Golden
import qualified Test.Cardano.Ledger.Alonzo.Serialisation.Canonical as Canonical
import qualified Test.Cardano.Ledger.Alonzo.Serialisation.Tripping as Tripping
import qualified Test.Cardano.Ledger.Alonzo.Translation as Translation
import qualified Test.Cardano.Ledger.Alonzo.TxInfo as TxInfo
import Test.Cardano.Ledger.EraBuffet (TestCrypto)
import qualified Test.Cardano.Ledger.Shelley.PropertyTests as Shelley
import qualified Test.Cardano.Ledger.Shelley.Rules.AdaPreservation as AdaPreservation
import qualified Test.Cardano.Ledger.Shelley.Rules.IncrementalStake as IncrementalStake
import Test.Tasty

type A = AlonzoEra TestCrypto

main :: IO ()
IO ()
main = do
  Maybe String
nightly <- String -> IO (Maybe String)
lookupEnv String
"NIGHTLY"
  TestTree -> IO ()
defaultMain forall a b. (a -> b) -> a -> b
$ case Maybe String
nightly of
    Maybe String
Nothing -> TestTree
defaultTests
    Just String
_ -> TestTree
nightlyTests

defaultTests :: TestTree
defaultTests :: TestTree
defaultTests =
  String -> [TestTree] -> TestTree
testGroup
    String
"Alonzo tests"
    [ forall era ledger.
(EraGen era, TestingLedger era ledger, ChainProperty era,
 HasTrace (CHAIN era) (GenEnv era),
 GovState era ~ ShelleyGovState era) =>
Int -> TestTree
AdaPreservation.tests @A @(AlonzoLEDGER A) Int
50
    , TestTree
Tripping.tests
    , TestTree
Translation.tests
    , TestTree
Canonical.tests
    , TestTree
Golden.tests
    , TestTree
TxInfo.tests
    ]

nightlyTests :: TestTree
nightlyTests :: TestTree
nightlyTests =
  String -> [TestTree] -> TestTree
testGroup
    String
"Alonzo tests - nightly"
    forall a b. (a -> b) -> a -> b
$ forall era ledger.
(EraGen era, ChainProperty era, HasTrace (CHAIN era) (GenEnv era),
 HasTrace ledger (GenEnv era), Embed (EraRule "DELEGS" era) ledger,
 Embed (EraRule "UTXOW" era) ledger,
 Environment ledger ~ LedgerEnv era, BaseEnv ledger ~ Globals,
 BaseM ledger ~ ReaderT Globals Identity,
 State ledger ~ LedgerState era, Signal ledger ~ Tx era,
 GovState era ~ ShelleyGovState era) =>
[TestTree]
Shelley.commonTests @A @(AlonzoLEDGER A)
      forall a. [a] -> [a] -> [a]
++ [ forall era.
(EraGen era, HasTrace (CHAIN era) (GenEnv era), EraGov era) =>
Proxy era -> TestTree
IncrementalStake.incrStakeComparisonTest (forall {k} (t :: k). Proxy t
Proxy :: Proxy A)
         , TestTree
ChainTrace.tests
         ]