{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} module Test.Cardano.Ledger.Allegra.Binary.CddlSpec (spec) where import Cardano.Ledger.Allegra (AllegraEra) import Cardano.Ledger.Core import Test.Cardano.Ledger.Allegra.Binary.Cddl (readAllegraCddlFiles) import Test.Cardano.Ledger.Allegra.CDDL (allegraCDDL) import Test.Cardano.Ledger.Binary.Cddl ( beforeAllCddlFile, cddlRoundTripAnnCborSpec, cddlRoundTripCborSpec, ) import Test.Cardano.Ledger.Binary.Cuddle import Test.Cardano.Ledger.Common spec :: Spec spec :: Spec spec = forall a. HasCallStack => String -> SpecWith a -> SpecWith a describe String "CDDL" forall a b. (a -> b) -> a -> b $ do let v :: Version v = forall era. Era era => Version eraProtVerLow @AllegraEra forall a. HasCallStack => String -> SpecWith a -> SpecWith a describe String "Ruby-based" forall a b. (a -> b) -> a -> b $ HasCallStack => Int -> IO [ByteString] -> SpecWith CddlData -> Spec beforeAllCddlFile Int 3 IO [ByteString] readAllegraCddlFiles forall a b. (a -> b) -> a -> b $ do forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR a) => Version -> Text -> SpecWith CddlData cddlRoundTripCborSpec @(Value AllegraEra) Version v Text "coin" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CddlData cddlRoundTripAnnCborSpec @(TxBody AllegraEra) Version v Text "transaction_body" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CddlData cddlRoundTripAnnCborSpec @(Script AllegraEra) Version v Text "native_script" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CddlData cddlRoundTripAnnCborSpec @(TxAuxData AllegraEra) Version v Text "auxiliary_data" forall a. HasCallStack => String -> SpecWith a -> SpecWith a describe String "Huddle" forall a b. (a -> b) -> a -> b $ Huddle -> Int -> SpecWith CuddleData -> Spec specWithHuddle Huddle allegraCDDL Int 100 forall a b. (a -> b) -> a -> b $ do forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR a) => Version -> Text -> SpecWith CuddleData huddleRoundTripCborSpec @(Value AllegraEra) Version v Text "coin" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CuddleData huddleRoundTripAnnCborSpec @(TxBody AllegraEra) Version v Text "transaction_body" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CuddleData huddleRoundTripAnnCborSpec @(TxAuxData AllegraEra) Version v Text "auxiliary_data" forall a. (HasCallStack, Eq a, Show a, EncCBOR a, DecCBOR (Annotator a)) => Version -> Text -> SpecWith CuddleData huddleRoundTripAnnCborSpec @(Script AllegraEra) Version v Text "native_script"