| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Cardano.Ledger.Binary.Vintage.Helpers.GoldenRoundTrip
Synopsis
- goldenTestCBOR ∷ ∀ a. (DecCBOR a, EncCBOR a, Eq a, Show a, HasCallStack) ⇒ a → FilePath → Property
- goldenTestCBORExplicit ∷ ∀ a. (Eq a, Show a, HasCallStack) ⇒ Text → (a → Encoding) → (∀ s. Decoder s a) → a → FilePath → Property
- goldenTestExplicit ∷ ∀ a. (Eq a, Show a, HasCallStack) ⇒ (a → ByteString) → (ByteString → Either DecoderError a) → a → FilePath → Property
- roundTripsCBORShow ∷ (DecCBOR a, EncCBOR a, Eq a, MonadTest m, Show a, HasCallStack) ⇒ a → m ()
- roundTripsCBORBuildable ∷ (DecCBOR a, EncCBOR a, Eq a, MonadTest m, Buildable a, HasCallStack) ⇒ a → m ()
- compareHexDump ∷ (MonadTest m, HasCallStack) ⇒ HexDump → HexDump → m ()
- deprecatedGoldenDecode ∷ HasCallStack ⇒ Text → (∀ s. Decoder s ()) → FilePath → Property
Documentation
goldenTestCBOR ∷ ∀ a. (DecCBOR a, EncCBOR a, Eq a, Show a, HasCallStack) ⇒ a → FilePath → Property Source #
Check that the encode and decode function of the Bi instances work as
expected w.r.t. the give reference data, this is, given a value x::a, and
a file path fp:
- The encoded data should coincide with the contents of the
fp. - Decoding
fpshould give as a resultx
goldenTestCBORExplicit Source #
Arguments
| ∷ ∀ a. (Eq a, Show a, HasCallStack) | |
| ⇒ Text | Label for error reporting when decoding. |
| → (a → Encoding) | |
| → (∀ s. Decoder s a) | |
| → a | |
| → FilePath | |
| → Property |
Variant of goldenTestBi using custom encode and decode functions.
This is required for the encode/decode golden-tests for types that do no
have a Bi instance.
goldenTestExplicit ∷ ∀ a. (Eq a, Show a, HasCallStack) ⇒ (a → ByteString) → (ByteString → Either DecoderError a) → a → FilePath → Property Source #
roundTripsCBORShow ∷ (DecCBOR a, EncCBOR a, Eq a, MonadTest m, Show a, HasCallStack) ⇒ a → m () Source #
roundTripsCBORBuildable ∷ (DecCBOR a, EncCBOR a, Eq a, MonadTest m, Buildable a, HasCallStack) ⇒ a → m () Source #
compareHexDump ∷ (MonadTest m, HasCallStack) ⇒ HexDump → HexDump → m () Source #
A custom version of (===) for HexDumps to get prettier diffs
deprecatedGoldenDecode ∷ HasCallStack ⇒ Text → (∀ s. Decoder s ()) → FilePath → Property Source #