module Test.Cardano.Ledger.Shelley.ShelleyTranslation (testGroupShelleyTranslation) where

import Cardano.Ledger.Shelley (ShelleyEra)
import Cardano.Ledger.Shelley.AdaPots (totalAdaES)
import Cardano.Ledger.Shelley.LedgerState (EpochState, returnRedeemAddrsToReserves)
import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes (C_Crypto)
import Test.Cardano.Ledger.Shelley.Generator.ShelleyEraGen ()
import Test.Cardano.Ledger.Shelley.Serialisation.EraIndepGenerators ()
import Test.Cardano.Ledger.Shelley.Serialisation.Generators ()
import Test.Tasty
import Test.Tasty.QuickCheck

testGroupShelleyTranslation :: TestTree
testGroupShelleyTranslation :: TestTree
testGroupShelleyTranslation =
  TestName -> [TestTree] -> TestTree
testGroup
    TestName
"Translation from Shelley to Allegra"
    [ forall a. Testable a => TestName -> a -> TestTree
testProperty TestName
"returning redeemers preserves ada" EpochState (ShelleyEra C_Crypto) -> Property
propRemoveRedeemPreservesAda
    ]

propRemoveRedeemPreservesAda ::
  EpochState (ShelleyEra C_Crypto) -> Property
propRemoveRedeemPreservesAda :: EpochState (ShelleyEra C_Crypto) -> Property
propRemoveRedeemPreservesAda EpochState (ShelleyEra C_Crypto)
es =
  forall era. (EraTxOut era, EraGov era) => EpochState era -> Coin
totalAdaES EpochState (ShelleyEra C_Crypto)
es forall a. (Eq a, Show a) => a -> a -> Property
=== (forall era. (EraTxOut era, EraGov era) => EpochState era -> Coin
totalAdaES forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. EraTxOut era => EpochState era -> EpochState era
returnRedeemAddrsToReserves) EpochState (ShelleyEra C_Crypto)
es