{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Test.Consensus.Shelley.Golden (tests) where
import Ouroboros.Consensus.Ledger.Query (QueryVersion)
import Ouroboros.Consensus.Shelley.Ledger.NetworkProtocolVersion
import Ouroboros.Consensus.Shelley.Node ()
import System.FilePath ((</>))
import Test.Consensus.Shelley.Examples
import Test.Tasty
import Test.Util.Paths
import Test.Util.Serialisation.Golden
tests :: TestTree
tests :: TestTree
tests = CodecConfig StandardShelleyBlock
-> FilePath -> Examples StandardShelleyBlock -> TestTree
forall blk.
(SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk,
SerialiseNodeToClientConstraints blk,
SupportedNetworkProtocolVersion blk,
ToGoldenDirectory (BlockNodeToNodeVersion blk),
ToGoldenDirectory (QueryVersion, BlockNodeToClientVersion blk),
HasCallStack) =>
CodecConfig blk -> FilePath -> Examples blk -> TestTree
goldenTest_all CodecConfig StandardShelleyBlock
codecConfig ($(getGoldenDir) FilePath -> FilePath -> FilePath
</> FilePath
"shelley") Examples StandardShelleyBlock
examplesShelley
instance ToGoldenDirectory ShelleyNodeToNodeVersion
instance ToGoldenDirectory (QueryVersion, ShelleyNodeToClientVersion) where
toGoldenDirectory :: (QueryVersion, ShelleyNodeToClientVersion) -> FilePath
toGoldenDirectory (QueryVersion
queryVersion, ShelleyNodeToClientVersion
blockVersion)
= QueryVersion -> FilePath
forall a. Show a => a -> FilePath
show QueryVersion
queryVersion FilePath -> FilePath -> FilePath
</> ShelleyNodeToClientVersion -> FilePath
forall a. Show a => a -> FilePath
show ShelleyNodeToClientVersion
blockVersion