-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cbor
RoundTrip
tests for blocks for each era
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
libs/cardano-protocol-tpraos/test/Test/Cardano/Protocol/Binary/RoundTrip.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module Test.Cardano.Protocol.Binary.RoundTrip (spec) where | ||
|
||
import Cardano.Ledger.Allegra (AllegraEra) | ||
import Cardano.Ledger.Alonzo (AlonzoEra) | ||
import Cardano.Ledger.Babbage (BabbageEra) | ||
import Cardano.Ledger.Block (Block) | ||
import Cardano.Ledger.Conway (ConwayEra) | ||
import Cardano.Ledger.Core | ||
import Cardano.Ledger.Mary (MaryEra) | ||
import Cardano.Ledger.Shelley (ShelleyEra) | ||
import Cardano.Protocol.Crypto (StandardCrypto) | ||
import Cardano.Protocol.TPraos.BHeader (BHeader) | ||
import Data.Typeable | ||
import Test.Cardano.Ledger.Common | ||
import Test.Cardano.Ledger.Conway.Arbitrary () | ||
import Test.Cardano.Ledger.Core.Binary.RoundTrip | ||
import Test.Cardano.Protocol.TPraos.Arbitrary () | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "RoundTrip" $ do | ||
roundTripBlock @ShelleyEra | ||
roundTripBlock @AllegraEra | ||
roundTripBlock @MaryEra | ||
roundTripBlock @AlonzoEra | ||
roundTripBlock @BabbageEra | ||
roundTripBlock @ConwayEra | ||
|
||
roundTripBlock :: | ||
forall era. | ||
( EraSegWits era | ||
, Arbitrary (Tx era) | ||
) => | ||
Spec | ||
roundTripBlock = | ||
prop (show (typeRep $ Proxy @(Block (BHeader StandardCrypto) era))) $ | ||
withMaxSuccess 3 $ | ||
roundTripAnnEraExpectation @era @(Block (BHeader StandardCrypto) era) |