{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} module Test.Cardano.Ledger.Dijkstra.GoldenSpec (spec) where import Cardano.Ledger.Dijkstra (DijkstraEra) import Cardano.Ledger.Dijkstra.Tx (DijkstraEraTx (hashTx)) import Cardano.Ledger.Hashes (extractHash) import Paths_cardano_ledger_dijkstra (getDataFileName) import Test.Cardano.Ledger.Binary.Golden (goldenForHashHex) import Test.Cardano.Ledger.Common import Test.Cardano.Ledger.Core.JSON (goldenJsonPParamsSpec, goldenJsonPParamsUpdateSpec) import Test.Cardano.Ledger.Dijkstra.Era () import Test.Cardano.Ledger.Dijkstra.Examples (exampleDijkstraTx) spec :: Spec spec :: Spec spec = String -> Spec -> Spec forall a. HasCallStack => String -> SpecWith a -> SpecWith a describe String "Golden" (Spec -> Spec) -> Spec -> Spec forall a b. (a -> b) -> a -> b $ do IO String -> SpecWith String -> Spec forall a. HasCallStack => IO a -> SpecWith a -> Spec beforeAll (String -> IO String getDataFileName String "golden/pparams.json") (SpecWith String -> Spec) -> SpecWith String -> Spec forall a b. (a -> b) -> a -> b $ forall era. (HasCallStack, EraPParams era) => SpecWith String goldenJsonPParamsSpec @DijkstraEra IO String -> SpecWith String -> Spec forall a. HasCallStack => IO a -> SpecWith a -> Spec beforeAll (String -> IO String getDataFileName String "golden/pparams-update.json") (SpecWith String -> Spec) -> SpecWith String -> Spec forall a b. (a -> b) -> a -> b $ forall era. (HasCallStack, EraTest era) => SpecWith String goldenJsonPParamsUpdateSpec @DijkstraEra String -> IO (Golden String) -> SpecWith (Arg (IO (Golden String))) forall a. (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) it String "hashTx" (IO (Golden String) -> SpecWith (Arg (IO (Golden String)))) -> IO (Golden String) -> SpecWith (Arg (IO (Golden String))) forall a b. (a -> b) -> a -> b $ (String -> IO String) -> Golden String -> IO (Golden String) forall g. (String -> IO String) -> Golden g -> IO (Golden g) toPackageGolden String -> IO String getDataFileName (Golden String -> IO (Golden String)) -> Golden String -> IO (Golden String) forall a b. (a -> b) -> a -> b $ String -> Hash HASH EraIndependentTx -> Golden String forall h a. String -> Hash h a -> Golden String goldenForHashHex String "golden/hashtx.hex" (SafeHash EraIndependentTx -> Hash HASH EraIndependentTx forall i. SafeHash i -> Hash HASH i extractHash (SafeHash EraIndependentTx -> Hash HASH EraIndependentTx) -> SafeHash EraIndependentTx -> Hash HASH EraIndependentTx forall a b. (a -> b) -> a -> b $ Tx TopTx DijkstraEra -> SafeHash EraIndependentTx forall era. DijkstraEraTx era => Tx TopTx era -> SafeHash EraIndependentTx hashTx Tx TopTx DijkstraEra exampleDijkstraTx)