{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE TypeApplications #-}

module Test.Cardano.Ledger.Binary.RoundTripSpec (spec) where

import Cardano.Crypto.DSIGN.Class (SigDSIGN, SignKeyDSIGN, SignedDSIGN, VerKeyDSIGN)
import Cardano.Crypto.DSIGN.EcdsaSecp256k1 (EcdsaSecp256k1DSIGN)
import Cardano.Crypto.DSIGN.Ed25519 (Ed25519DSIGN)
import Cardano.Crypto.DSIGN.Ed448 (Ed448DSIGN)
import Cardano.Crypto.DSIGN.Mock (MockDSIGN)
import Cardano.Crypto.DSIGN.SchnorrSecp256k1 (SchnorrSecp256k1DSIGN)
import Cardano.Crypto.Hash.Blake2b (Blake2b_224, Blake2b_256)
import Cardano.Crypto.Hash.Class (Hash)
import Cardano.Crypto.Hash.Keccak256 (Keccak256)
import Cardano.Crypto.Hash.SHA256 (SHA256)
import Cardano.Crypto.Hash.SHA3_256 (SHA3_256)
import Cardano.Crypto.Hash.Short (ShortHash)
import Cardano.Crypto.KES.Class (SigKES, VerKeyKES)
import Cardano.Crypto.KES.CompactSingle (CompactSingleKES)
import Cardano.Crypto.KES.CompactSum (
  CompactSum0KES,
  CompactSum1KES,
  CompactSum2KES,
  CompactSum3KES,
  CompactSum4KES,
  CompactSum5KES,
  CompactSum6KES,
  CompactSum7KES,
 )
import Cardano.Crypto.KES.Mock (MockKES)
import Cardano.Crypto.KES.Simple (SimpleKES)
import Cardano.Crypto.KES.Sum (
  Sum0KES,
  Sum1KES,
  Sum2KES,
  Sum3KES,
  Sum4KES,
  Sum5KES,
  Sum6KES,
  Sum7KES,
 )
import Cardano.Crypto.VRF.Class (CertVRF, CertifiedVRF, OutputVRF, SignKeyVRF, VerKeyVRF)
import Cardano.Crypto.VRF.Mock (MockVRF)
import Cardano.Crypto.VRF.Praos (PraosVRF)
import Cardano.Crypto.VRF.Simple (SimpleVRF)
import Cardano.Ledger.Binary
import qualified Cardano.Ledger.Binary.Plain as Plain
import Cardano.Slotting.Block (BlockNo)
import Cardano.Slotting.Slot (EpochNo, EpochSize, SlotNo, WithOrigin)
import Cardano.Slotting.Time (SystemStart)
import Codec.CBOR.ByteArray.Sliced (SlicedByteArray (..))
import Control.Monad (when)
import qualified Data.ByteString.Lazy as BSL
import Data.Fixed (Nano, Pico)
import Data.Foldable as F
import Data.IP (IPv4, IPv6)
import Data.Int
import qualified Data.Map.Strict as Map
import Data.Maybe
import Data.Maybe.Strict
import qualified Data.Primitive.ByteArray as Prim (ByteArray)
import Data.Ratio
import qualified Data.Sequence as Seq
import qualified Data.Sequence.Strict as SSeq
import qualified Data.Set as Set
import Data.Tagged (Tagged (Tagged))
import Data.Time.Clock (UTCTime)
import qualified Data.VMap as VMap
import qualified Data.Vector as V
import qualified Data.Vector.Primitive as VP
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
import Data.Word
import Numeric.Natural
import Test.Cardano.Ledger.Binary.Arbitrary ()
import Test.Cardano.Ledger.Binary.RoundTrip
import Test.Hspec
import Test.QuickCheck

-- This type is for testing roundtripping of types that need access to their bytes. The first field
-- is a boolean indicator that decides whether we should use the actual type of interest (it is
-- Float in here) or the preencoded bytes whenever we do the encoding. The last type is there just
-- so we have some data that follows, whcih ensures out offsets are used correctly
data SubBytes = SubBytes Bool (Annotated Float BSL.ByteString) (Maybe Word)
  deriving (SubBytes -> SubBytes -> Bool
(SubBytes -> SubBytes -> Bool)
-> (SubBytes -> SubBytes -> Bool) -> Eq SubBytes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubBytes -> SubBytes -> Bool
== :: SubBytes -> SubBytes -> Bool
$c/= :: SubBytes -> SubBytes -> Bool
/= :: SubBytes -> SubBytes -> Bool
Eq, Int -> SubBytes -> ShowS
[SubBytes] -> ShowS
SubBytes -> String
(Int -> SubBytes -> ShowS)
-> (SubBytes -> String) -> ([SubBytes] -> ShowS) -> Show SubBytes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubBytes -> ShowS
showsPrec :: Int -> SubBytes -> ShowS
$cshow :: SubBytes -> String
show :: SubBytes -> String
$cshowList :: [SubBytes] -> ShowS
showList :: [SubBytes] -> ShowS
Show)

instance Arbitrary SubBytes where
  arbitrary :: Gen SubBytes
arbitrary = do
    Float
f <- Gen Float
forall a. Arbitrary a => Gen a
arbitrary
    let fAnn :: Annotated Float ByteString
fAnn = Float -> ByteString -> Annotated Float ByteString
forall b a. b -> a -> Annotated b a
Annotated Float
f (Float -> ByteString
forall a. ToCBOR a => a -> ByteString
Plain.serialize Float
f)
    Bool -> Annotated Float ByteString -> Maybe Word -> SubBytes
SubBytes (Bool -> Annotated Float ByteString -> Maybe Word -> SubBytes)
-> Gen Bool
-> Gen (Annotated Float ByteString -> Maybe Word -> SubBytes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Bool
forall a. Arbitrary a => Gen a
arbitrary Gen (Annotated Float ByteString -> Maybe Word -> SubBytes)
-> Gen (Annotated Float ByteString) -> Gen (Maybe Word -> SubBytes)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Annotated Float ByteString -> Gen (Annotated Float ByteString)
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Annotated Float ByteString
fAnn Gen (Maybe Word -> SubBytes) -> Gen (Maybe Word) -> Gen SubBytes
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (Maybe Word)
forall a. Arbitrary a => Gen a
arbitrary

instance DecCBOR SubBytes where
  decCBOR :: forall s. Decoder s SubBytes
decCBOR = Bool -> Annotated Float ByteString -> Maybe Word -> SubBytes
SubBytes (Bool -> Annotated Float ByteString -> Maybe Word -> SubBytes)
-> Decoder s Bool
-> Decoder s (Annotated Float ByteString -> Maybe Word -> SubBytes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Bool
forall s. Decoder s Bool
forall a s. DecCBOR a => Decoder s a
decCBOR Decoder s (Annotated Float ByteString -> Maybe Word -> SubBytes)
-> Decoder s (Annotated Float ByteString)
-> Decoder s (Maybe Word -> SubBytes)
forall a b. Decoder s (a -> b) -> Decoder s a -> Decoder s b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s (Annotated Float ByteString)
forall s. Decoder s (Annotated Float ByteString)
forall a s. DecCBOR a => Decoder s a
decCBOR Decoder s (Maybe Word -> SubBytes)
-> Decoder s (Maybe Word) -> Decoder s SubBytes
forall a b. Decoder s (a -> b) -> Decoder s a -> Decoder s b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s (Maybe Word)
forall s. Decoder s (Maybe Word)
forall a s. DecCBOR a => Decoder s a
decCBOR

instance EncCBOR SubBytes where
  encCBOR :: SubBytes -> Encoding
encCBOR (SubBytes Bool
x (Annotated Float
y ByteString
ybs) Maybe Word
z) =
    Bool -> Encoding
forall a. EncCBOR a => a -> Encoding
encCBOR Bool
x Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> (if Bool
x then Float -> Encoding
forall a. EncCBOR a => a -> Encoding
encCBOR Float
y else ByteString -> Encoding
encodePreEncoded (ByteString -> ByteString
BSL.toStrict ByteString
ybs)) Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Maybe Word -> Encoding
forall a. EncCBOR a => a -> Encoding
encCBOR Maybe Word
z

spec :: Spec
spec :: Spec
spec = do
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"RoundTrip" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @() Trip () ()
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Bool Trip Bool Bool
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Integer Trip Integer Integer
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Natural Trip Natural Natural
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Word Trip Word Word
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Word8 Trip Word8 Word8
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Word16 Trip Word16 Word16
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Word32 Trip Word32 Word32
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Word64 Trip Word64 Word64
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Int Trip Int Int
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Int8 Trip Int8 Int8
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Int16 Trip Int16 Int16
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Int32 Trip Int32 Int32
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Int64 Trip Int64 Int64
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Float Trip Float Float
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Double Trip Double Double
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Rational Trip Rational Rational
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Nano Trip Nano Nano
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Pico Trip Pico Pico
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @UTCTime Trip UTCTime UTCTime
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @IPv4 Trip IPv4 IPv4
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @IPv6 Trip IPv6 IPv6
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(Maybe Integer) Trip (Maybe Integer) (Maybe Integer)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(StrictMaybe Integer) Trip (StrictMaybe Integer) (StrictMaybe Integer)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @[Integer] Trip [Integer] [Integer]
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(V.Vector Integer) Trip (Vector Integer) (Vector Integer)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VS.Vector Int16) Trip (Vector Int16) (Vector Int16)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VP.Vector Int) Trip (Vector Int) (Vector Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VU.Vector (Bool, Word)) Trip (Vector (Bool, Word)) (Vector (Bool, Word))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(Set.Set Int) Trip (Set Int) (Set Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(Map.Map Integer Int) Trip (Map Integer Int) (Map Integer Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(Seq.Seq Int) Trip (Seq Int) (Seq Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SSeq.StrictSeq Int) Trip (StrictSeq Int) (StrictSeq Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VMap.VMap VMap.VB VMap.VS Integer Int) Trip (VMap VB VS Integer Int) (VMap VB VS Integer Int)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @Prim.ByteArray Trip ByteArray ByteArray
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @ByteArray Trip ByteArray ByteArray
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @SlicedByteArray Trip SlicedByteArray SlicedByteArray
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @SubBytes Trip SubBytes SubBytes
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(Maybe Integer) (Trip (Maybe Integer) (Maybe Integer) -> Spec)
-> Trip (Maybe Integer) (Maybe Integer) -> Spec
forall a b. (a -> b) -> a -> b
$
      (Maybe Integer -> Encoding)
-> (forall s. Decoder s (Maybe Integer))
-> Trip (Maybe Integer) (Maybe Integer)
forall a b. (a -> Encoding) -> (forall s. Decoder s b) -> Trip a b
mkTrip ((Integer -> Encoding) -> Maybe Integer -> Encoding
forall a. (a -> Encoding) -> Maybe a -> Encoding
encodeNullMaybe Integer -> Encoding
forall a. EncCBOR a => a -> Encoding
encCBOR) (Decoder s Integer -> Decoder s (Maybe Integer)
forall s a. Decoder s a -> Decoder s (Maybe a)
decodeNullMaybe Decoder s Integer
forall s. Decoder s Integer
forall a s. DecCBOR a => Decoder s a
decCBOR)
    forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(StrictMaybe Integer) (Trip (StrictMaybe Integer) (StrictMaybe Integer) -> Spec)
-> Trip (StrictMaybe Integer) (StrictMaybe Integer) -> Spec
forall a b. (a -> b) -> a -> b
$
      (StrictMaybe Integer -> Encoding)
-> (forall s. Decoder s (StrictMaybe Integer))
-> Trip (StrictMaybe Integer) (StrictMaybe Integer)
forall a b. (a -> Encoding) -> (forall s. Decoder s b) -> Trip a b
mkTrip ((Integer -> Encoding) -> StrictMaybe Integer -> Encoding
forall a. (a -> Encoding) -> StrictMaybe a -> Encoding
encodeNullStrictMaybe Integer -> Encoding
forall a. EncCBOR a => a -> Encoding
encCBOR) (Decoder s Integer -> Decoder s (StrictMaybe Integer)
forall s a. Decoder s a -> Decoder s (StrictMaybe a)
decodeNullStrictMaybe Decoder s Integer
forall s. Decoder s Integer
forall a s. DecCBOR a => Decoder s a
decCBOR)
    String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Slotting" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Mock" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @BlockNo Trip BlockNo BlockNo
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @SlotNo Trip SlotNo SlotNo
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(WithOrigin EpochNo) Trip (WithOrigin EpochNo) (WithOrigin EpochNo)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @EpochSize Trip EpochSize EpochSize
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @SystemStart Trip SystemStart SystemStart
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
    String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Crypto" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"DSIGN" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Ed25519" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyDSIGN Ed25519DSIGN) Trip (SignKeyDSIGN Ed25519DSIGN) (SignKeyDSIGN Ed25519DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyDSIGN Ed25519DSIGN) Trip (VerKeyDSIGN Ed25519DSIGN) (VerKeyDSIGN Ed25519DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigDSIGN Ed25519DSIGN) Trip (SigDSIGN Ed25519DSIGN) (SigDSIGN Ed25519DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignedDSIGN Ed25519DSIGN ()) Trip (SignedDSIGN Ed25519DSIGN ()) (SignedDSIGN Ed25519DSIGN ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Ed448" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyDSIGN Ed448DSIGN) Trip (SignKeyDSIGN Ed448DSIGN) (SignKeyDSIGN Ed448DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyDSIGN Ed448DSIGN) Trip (VerKeyDSIGN Ed448DSIGN) (VerKeyDSIGN Ed448DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigDSIGN Ed448DSIGN) Trip (SigDSIGN Ed448DSIGN) (SigDSIGN Ed448DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignedDSIGN Ed448DSIGN ()) Trip (SignedDSIGN Ed448DSIGN ()) (SignedDSIGN Ed448DSIGN ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"EcdsaSecp256k1" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyDSIGN EcdsaSecp256k1DSIGN) Trip
  (SignKeyDSIGN EcdsaSecp256k1DSIGN)
  (SignKeyDSIGN EcdsaSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyDSIGN EcdsaSecp256k1DSIGN) Trip
  (VerKeyDSIGN EcdsaSecp256k1DSIGN) (VerKeyDSIGN EcdsaSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigDSIGN EcdsaSecp256k1DSIGN) Trip (SigDSIGN EcdsaSecp256k1DSIGN) (SigDSIGN EcdsaSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignedDSIGN EcdsaSecp256k1DSIGN ()) Trip
  (SignedDSIGN EcdsaSecp256k1DSIGN ())
  (SignedDSIGN EcdsaSecp256k1DSIGN ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"SchnorrSecp256k1" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyDSIGN SchnorrSecp256k1DSIGN) Trip
  (SignKeyDSIGN SchnorrSecp256k1DSIGN)
  (SignKeyDSIGN SchnorrSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyDSIGN SchnorrSecp256k1DSIGN) Trip
  (VerKeyDSIGN SchnorrSecp256k1DSIGN)
  (VerKeyDSIGN SchnorrSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigDSIGN SchnorrSecp256k1DSIGN) Trip
  (SigDSIGN SchnorrSecp256k1DSIGN) (SigDSIGN SchnorrSecp256k1DSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignedDSIGN SchnorrSecp256k1DSIGN ()) Trip
  (SignedDSIGN SchnorrSecp256k1DSIGN ())
  (SignedDSIGN SchnorrSecp256k1DSIGN ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Mock" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyDSIGN MockDSIGN) Trip (SignKeyDSIGN MockDSIGN) (SignKeyDSIGN MockDSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyDSIGN MockDSIGN) Trip (VerKeyDSIGN MockDSIGN) (VerKeyDSIGN MockDSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigDSIGN MockDSIGN) Trip (SigDSIGN MockDSIGN) (SigDSIGN MockDSIGN)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignedDSIGN MockDSIGN ()) Trip (SignedDSIGN MockDSIGN ()) (SignedDSIGN MockDSIGN ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"VRF" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"OutputVRF" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(OutputVRF PraosVRF) Trip (OutputVRF PraosVRF) (OutputVRF PraosVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(CertifiedVRF PraosVRF Bool) Trip (CertifiedVRF PraosVRF Bool) (CertifiedVRF PraosVRF Bool)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Praos" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyVRF PraosVRF) Trip (SignKeyVRF PraosVRF) (SignKeyVRF PraosVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyVRF PraosVRF) Trip (VerKeyVRF PraosVRF) (VerKeyVRF PraosVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(CertVRF PraosVRF) Trip (CertVRF PraosVRF) (CertVRF PraosVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Simple" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyVRF SimpleVRF) Trip (SignKeyVRF SimpleVRF) (SignKeyVRF SimpleVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyVRF SimpleVRF) Trip (VerKeyVRF SimpleVRF) (VerKeyVRF SimpleVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(CertVRF SimpleVRF) Trip (CertVRF SimpleVRF) (CertVRF SimpleVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Mock" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SignKeyVRF MockVRF) Trip (SignKeyVRF MockVRF) (SignKeyVRF MockVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyVRF MockVRF) Trip (VerKeyVRF MockVRF) (VerKeyVRF MockVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(CertVRF MockVRF) Trip (CertVRF MockVRF) (CertVRF MockVRF)
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"KES" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"CompactSingle" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSingleKES Ed25519DSIGN)) Trip
  (VerKeyKES (CompactSingleKES Ed25519DSIGN))
  (VerKeyKES (CompactSingleKES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSingleKES Ed25519DSIGN)) Trip
  (SigKES (CompactSingleKES Ed25519DSIGN))
  (SigKES (CompactSingleKES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"CompactSum" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum0KES Ed25519DSIGN)) Trip
  (VerKeyKES (CompactSingleKES Ed25519DSIGN))
  (VerKeyKES (CompactSingleKES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum0KES Ed25519DSIGN)) Trip
  (SigKES (CompactSingleKES Ed25519DSIGN))
  (SigKES (CompactSingleKES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum1KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum1KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum1KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum1KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum1KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum1KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum2KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum2KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum2KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum2KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum2KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum2KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum3KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum3KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum3KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum3KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum3KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum3KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum4KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum4KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum4KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum4KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum4KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum4KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum5KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum5KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum5KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum5KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum5KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum5KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum6KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum6KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum6KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum6KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum6KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum6KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (CompactSum7KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (CompactSum7KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (CompactSum7KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (CompactSum7KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (CompactSum7KES Ed25519DSIGN Blake2b_256))
  (SigKES (CompactSum7KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Sum" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum0KES Ed25519DSIGN)) Trip
  (VerKeyKES (Sum0KES Ed25519DSIGN))
  (VerKeyKES (Sum0KES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum0KES Ed25519DSIGN)) Trip
  (SigKES (Sum0KES Ed25519DSIGN)) (SigKES (Sum0KES Ed25519DSIGN))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum1KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum1KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum1KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum1KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum1KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum1KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum2KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum2KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum2KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum2KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum2KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum2KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum3KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum3KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum3KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum3KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum3KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum3KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum4KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum4KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum4KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum4KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum4KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum4KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum5KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum5KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum5KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum5KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum5KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum5KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum6KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum6KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum6KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum6KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum6KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum6KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (Sum7KES Ed25519DSIGN Blake2b_256)) Trip
  (VerKeyKES (Sum7KES Ed25519DSIGN Blake2b_256))
  (VerKeyKES (Sum7KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (Sum7KES Ed25519DSIGN Blake2b_256)) Trip
  (SigKES (Sum7KES Ed25519DSIGN Blake2b_256))
  (SigKES (Sum7KES Ed25519DSIGN Blake2b_256))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
        -- below we also test some tuple roundtripping as well as KES
        String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Simple" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec
            @( VerKeyKES (SimpleKES Ed25519DSIGN 1)
             , VerKeyKES (SimpleKES Ed25519DSIGN 2)
             , VerKeyKES (SimpleKES Ed25519DSIGN 3)
             , VerKeyKES (SimpleKES Ed25519DSIGN 4)
             , VerKeyKES (SimpleKES Ed25519DSIGN 5)
             , VerKeyKES (SimpleKES Ed25519DSIGN 6)
             , VerKeyKES (SimpleKES Ed25519DSIGN 7)
             )
            Trip
  (VerKeyKES (SimpleKES Ed25519DSIGN 1),
   VerKeyKES (SimpleKES Ed25519DSIGN 2),
   VerKeyKES (SimpleKES Ed25519DSIGN 3),
   VerKeyKES (SimpleKES Ed25519DSIGN 4),
   VerKeyKES (SimpleKES Ed25519DSIGN 5),
   VerKeyKES (SimpleKES Ed25519DSIGN 6),
   VerKeyKES (SimpleKES Ed25519DSIGN 7))
  (VerKeyKES (SimpleKES Ed25519DSIGN 1),
   VerKeyKES (SimpleKES Ed25519DSIGN 2),
   VerKeyKES (SimpleKES Ed25519DSIGN 3),
   VerKeyKES (SimpleKES Ed25519DSIGN 4),
   VerKeyKES (SimpleKES Ed25519DSIGN 5),
   VerKeyKES (SimpleKES Ed25519DSIGN 6),
   VerKeyKES (SimpleKES Ed25519DSIGN 7))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec
            @( SigKES (SimpleKES Ed25519DSIGN 1)
             , SigKES (SimpleKES Ed25519DSIGN 2)
             , SigKES (SimpleKES Ed25519DSIGN 3)
             , SigKES (SimpleKES Ed25519DSIGN 4)
             )
            Trip
  (SigKES (SimpleKES Ed25519DSIGN 1),
   SigKES (SimpleKES Ed25519DSIGN 2),
   SigKES (SimpleKES Ed25519DSIGN 3),
   SigKES (SimpleKES Ed25519DSIGN 4))
  (SigKES (SimpleKES Ed25519DSIGN 1),
   SigKES (SimpleKES Ed25519DSIGN 2),
   SigKES (SimpleKES Ed25519DSIGN 3),
   SigKES (SimpleKES Ed25519DSIGN 4))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec
            @( SigKES (SimpleKES Ed25519DSIGN 5)
             , SigKES (SimpleKES Ed25519DSIGN 6)
             , SigKES (SimpleKES Ed25519DSIGN 7)
             )
            Trip
  (SigKES (SimpleKES Ed25519DSIGN 5),
   SigKES (SimpleKES Ed25519DSIGN 6),
   SigKES (SimpleKES Ed25519DSIGN 7))
  (SigKES (SimpleKES Ed25519DSIGN 5),
   SigKES (SimpleKES Ed25519DSIGN 6),
   SigKES (SimpleKES Ed25519DSIGN 7))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
          String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Mock" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
            forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(VerKeyKES (MockKES 7)) Trip (VerKeyKES (MockKES 7)) (VerKeyKES (MockKES 7))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
            forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec @(SigKES (MockKES 7)) Trip (SigKES (MockKES 7)) (SigKES (MockKES 7))
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Hash" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        forall t.
(Show t, Eq t, Typeable t, Arbitrary t) =>
Trip t t -> Spec
roundTripSpec
          @( Hash Blake2b_224 ()
           , Hash Blake2b_256 ()
           , Hash SHA256 ()
           , Hash SHA3_256 ()
           , Hash Keccak256 ()
           , Hash ShortHash ()
           )
          Trip
  (Hash Blake2b_224 (), Hash Blake2b_256 (), Hash SHA256 (),
   Hash SHA3_256 (), Hash Keccak256 (), Hash ShortHash ())
  (Hash Blake2b_224 (), Hash Blake2b_256 (), Hash SHA256 (),
   Hash SHA3_256 (), Hash Keccak256 (), Hash ShortHash ())
forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip
  String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"EmbedTrip" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
    [Version] -> (Version -> Spec) -> Spec
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [Version
shelleyProtVer .. Version
forall a. Bounded a => a
maxBound] ((Version -> Spec) -> Spec) -> (Version -> Spec) -> Spec
forall a b. (a -> b) -> a -> b
$ \Version
v ->
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe (Version -> String
forall a. Show a => a -> String
show Version
v) (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        Version
-> Version
-> Trip Word8 Word16
-> (Word16 -> Word8 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Word8 @Word16) ((Word16 -> Word8 -> Expectation) -> Spec)
-> (Word16 -> Word8 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Word16
n Word8
w -> Word16
n Word16 -> Word16 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
w
        Version
-> Version
-> Trip Word16 Word32
-> (Word32 -> Word16 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Word16 @Word32) ((Word32 -> Word16 -> Expectation) -> Spec)
-> (Word32 -> Word16 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Word32
n Word16
w -> Word32
n Word32 -> Word32 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Word16 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
w
        Version
-> Version
-> Trip Word32 Word64
-> (Word64 -> Word32 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Word32 @Word64) ((Word64 -> Word32 -> Expectation) -> Spec)
-> (Word64 -> Word32 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Word64
n Word32
w -> Word64
n Word64 -> Word64 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
w
        Version
-> Version
-> Trip Word Natural
-> (Natural -> Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Word @Natural) ((Natural -> Word -> Expectation) -> Spec)
-> (Natural -> Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Natural
n Word
w -> Natural
n Natural -> Natural -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Word -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
w
        Version
-> Version
-> Trip Int8 Int16
-> (Int16 -> Int8 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Int8 @Int16) ((Int16 -> Int8 -> Expectation) -> Spec)
-> (Int16 -> Int8 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Int16
n Int8
w -> Int16
n Int16 -> Int16 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Int8 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int8
w
        Version
-> Version
-> Trip Int16 Int32
-> (Int32 -> Int16 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Int16 @Int32) ((Int32 -> Int16 -> Expectation) -> Spec)
-> (Int32 -> Int16 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Int32
n Int16
w -> Int32
n Int32 -> Int32 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Int16 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int16
w
        Version
-> Version
-> Trip Int32 Int64
-> (Int64 -> Int32 -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Int32 @Int64) ((Int64 -> Int32 -> Expectation) -> Spec)
-> (Int64 -> Int32 -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Int64
n Int32
w -> Int64
n Int64 -> Int64 -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Int32 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
w
        Version
-> Version
-> Trip Int Integer
-> (Integer -> Int -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Int @Integer) ((Integer -> Int -> Expectation) -> Spec)
-> (Integer -> Int -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Integer
n Int
w -> Integer
n Integer -> Integer -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
w
        Version
-> Version
-> Trip Int (Tagged () Int)
-> (Tagged () Int -> Int -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Int @(Tagged () Int)) ((Tagged () Int -> Int -> Expectation) -> Spec)
-> (Tagged () Int -> Int -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \(Tagged Int
i') Int
i -> Int
i' Int -> Int -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Int
i
        Version
-> Version
-> Trip (Maybe Word) [Word]
-> ([Word] -> Maybe Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Maybe Word) @[Word]) (([Word] -> Maybe Word -> Expectation) -> Spec)
-> ([Word] -> Maybe Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs Maybe Word
mx -> [Word] -> Maybe Word
forall a. [a] -> Maybe a
listToMaybe [Word]
xs Maybe Word -> Maybe Word -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Maybe Word
mx
        Version
-> Version
-> Trip (StrictMaybe Word) (Maybe Word)
-> (Maybe Word -> StrictMaybe Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(StrictMaybe Word) @(Maybe Word)) ((Maybe Word -> StrictMaybe Word -> Expectation) -> Spec)
-> (Maybe Word -> StrictMaybe Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Maybe Word
m StrictMaybe Word
sm -> Maybe Word
m Maybe Word -> Maybe Word -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` StrictMaybe Word -> Maybe Word
forall a. StrictMaybe a -> Maybe a
strictMaybeToMaybe StrictMaybe Word
sm
        Version
-> Version
-> Trip (Maybe Word) (StrictMaybe Word)
-> (StrictMaybe Word -> Maybe Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Maybe Word) @(StrictMaybe Word)) ((StrictMaybe Word -> Maybe Word -> Expectation) -> Spec)
-> (StrictMaybe Word -> Maybe Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \StrictMaybe Word
sm Maybe Word
m -> StrictMaybe Word
sm StrictMaybe Word -> StrictMaybe Word -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Maybe Word -> StrictMaybe Word
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe Maybe Word
m
        Version
-> Version
-> Trip (Word, Word) [Word]
-> ([Word] -> (Word, Word) -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Word, Word) @[Word]) (([Word] -> (Word, Word) -> Expectation) -> Spec)
-> ([Word] -> (Word, Word) -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs (Word
x, Word
y) -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` [Word
x, Word
y]
        Version
-> Version
-> Trip (Word, Word, Word) [Word]
-> ([Word] -> (Word, Word, Word) -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Word, Word, Word) @[Word]) (([Word] -> (Word, Word, Word) -> Expectation) -> Spec)
-> ([Word] -> (Word, Word, Word) -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs (Word
x, Word
y, Word
z) -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` [Word
x, Word
y, Word
z]
        Version
-> Version
-> Trip (Word, Word, Word, Word) [Word]
-> ([Word] -> (Word, Word, Word, Word) -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Word, Word, Word, Word) @[Word]) (([Word] -> (Word, Word, Word, Word) -> Expectation) -> Spec)
-> ([Word] -> (Word, Word, Word, Word) -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs (Word
a, Word
b, Word
c, Word
d) -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` [Word
a, Word
b, Word
c, Word
d]
        Version
-> Version
-> Trip (Word, Word, Word, Word, Word) [Word]
-> ([Word] -> (Word, Word, Word, Word, Word) -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Word, Word, Word, Word, Word) @[Word]) (([Word] -> (Word, Word, Word, Word, Word) -> Expectation) -> Spec)
-> ([Word] -> (Word, Word, Word, Word, Word) -> Expectation)
-> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs (Word
a, Word
b, Word
c, Word
d, Word
e) -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` [Word
a, Word
b, Word
c, Word
d, Word
e]
        Version
-> Version
-> Trip (Word, Word, Word, Word, Word, Word) [Word]
-> ([Word] -> (Word, Word, Word, Word, Word, Word) -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Word, Word, Word, Word, Word, Word) @[Word]) (([Word] -> (Word, Word, Word, Word, Word, Word) -> Expectation)
 -> Spec)
-> ([Word] -> (Word, Word, Word, Word, Word, Word) -> Expectation)
-> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs (Word
a, Word
b, Word
c, Word
d, Word
e, Word
f) -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` [Word
a, Word
b, Word
c, Word
d, Word
e, Word
f]
        Version
-> Version
-> Trip (Vector Word) [Word]
-> ([Word] -> Vector Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(VP.Vector Word) @[Word]) (([Word] -> Vector Word -> Expectation) -> Spec)
-> ([Word] -> Vector Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs Vector Word
sxs -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Vector Word -> [Word]
forall a. Prim a => Vector a -> [a]
VP.toList Vector Word
sxs
        Version
-> Version
-> Trip (Seq Word) [Word]
-> ([Word] -> Seq Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Seq.Seq Word) @[Word]) (([Word] -> Seq Word -> Expectation) -> Spec)
-> ([Word] -> Seq Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs Seq Word
sxs -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Seq Word -> [Word]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
F.toList Seq Word
sxs
        Version
-> Version
-> Trip (StrictSeq Word) [Word]
-> ([Word] -> StrictSeq Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(SSeq.StrictSeq Word) @[Word]) (([Word] -> StrictSeq Word -> Expectation) -> Spec)
-> ([Word] -> StrictSeq Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \[Word]
xs StrictSeq Word
sxs -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` StrictSeq Word -> [Word]
forall a. StrictSeq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
F.toList StrictSeq Word
sxs
        Bool -> Spec -> Spec
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Version
v Version -> Version -> Bool
forall a. Ord a => a -> a -> Bool
< forall (v :: Natural).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @9) (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
          -- Starting with version 9 Set is prefixed with tag 258, which prevents it from
          -- being deserialized into a list.
          Version
-> Version
-> Trip (Set Word) [Word]
-> ([Word] -> Set Word -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(Set.Set Word) @[Word]) (([Word] -> Set Word -> Expectation) -> Spec)
-> ([Word] -> Set Word -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
            \[Word]
xs Set Word
sxs -> [Word]
xs [Word] -> [Word] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` Set Word -> [Word]
forall a. Set a -> [a]
Set.toList Set Word
sxs
        Version
-> Version
-> Trip (VMap VP VP Word Int) (Map Word Int)
-> (Map Word Int -> VMap VP VP Word Int -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @(VMap.VMap VMap.VP VMap.VP Word Int) @(Map.Map Word Int)) ((Map Word Int -> VMap VP VP Word Int -> Expectation) -> Spec)
-> (Map Word Int -> VMap VP VP Word Int -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \Map Word Int
xs VMap VP VP Word Int
sxs -> Map Word Int
xs Map Word Int -> Map Word Int -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` VMap VP VP Word Int -> Map Word Int
forall (kv :: * -> *) k (vv :: * -> *) v.
(Vector kv k, Vector vv v) =>
VMap kv vv k v -> Map k v
VMap.toMap VMap VP VP Word Int
sxs
    [Version] -> (Version -> Spec) -> Spec
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [Version
forall a. Bounded a => a
minBound .. forall (v :: Natural).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @8] ((Version -> Spec) -> Spec) -> (Version -> Spec) -> Spec
forall a b. (a -> b) -> a -> b
$ \Version
v ->
      String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe (Version -> String
forall a. Show a => a -> String
show Version
v) (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
        Version
-> Version
-> Trip Rational (Integer, Integer)
-> ((Integer, Integer) -> Rational -> Expectation)
-> Spec
forall a b.
(Show a, Typeable a, Typeable b, Arbitrary a, Eq b,
 HasCallStack) =>
Version -> Version -> Trip a b -> (b -> a -> Expectation) -> Spec
embedTripSpec Version
v Version
v (forall a b. (EncCBOR a, DecCBOR b) => Trip a b
cborTrip @Rational @(Integer, Integer)) (((Integer, Integer) -> Rational -> Expectation) -> Spec)
-> ((Integer, Integer) -> Rational -> Expectation) -> Spec
forall a b. (a -> b) -> a -> b
$
          \(Integer
x, Integer
y) Rational
r -> (Integer
x, Integer
y) (Integer, Integer) -> (Integer, Integer) -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`shouldBe` (Rational -> Integer
forall a. Ratio a -> a
numerator Rational
r, Rational -> Integer
forall a. Ratio a -> a
denominator Rational
r)