| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Crypto.Util
Synopsis
- class Typeable a ⇒ FromCBOR a where
- class Typeable a ⇒ ToCBOR a where
- prop_cbor ∷ (ToCBOR a, FromCBOR a, Eq a, Show a) ⇒ a → Property
- prop_cbor_size ∷ ∀ a. ToCBOR a ⇒ a → Property
- prop_cbor_fixed_sized ∷ (FixedSizeCodec a, Eq a, Show a) ⇒ a → Property
- prop_cbor_valid ∷ (a → Encoding) → a → Property
- prop_cbor_roundtrip ∷ (Eq a, Show a) ⇒ (a → Encoding) → (∀ s. Decoder s a) → a → Property
- prop_raw_serialise ∷ (Eq a, Show a) ⇒ (a → ByteString) → (ByteString → Maybe a) → a → Property
- prop_raw_serialise_fixed_sized ∷ (Eq a, Show a, FixedSizeCodec a) ⇒ a → Property
- prop_raw_deserialise ∷ ∀ (a ∷ Type). Show a ⇒ (ByteString → Maybe a) → BadInputFor a → Property
- prop_raw_deserialise_fixed_sized ∷ ∀ (a ∷ Type). (FixedSizeCodec a, Show a) ⇒ BadInputFor a → Property
- prop_size_serialise ∷ (a → ByteString) → Word → a → Property
- prop_size_serialise_fixed_sized ∷ ∀ a. FixedSizeCodec a ⇒ a → Property
- prop_cbor_fixed_sized_vs_class ∷ (FixedSizeCodec a, ToCBOR a) ⇒ a → Property
- prop_bad_cbor_bytes ∷ ∀ (a ∷ Type). (Show a, FromCBOR a) ⇒ BadInputFor a → Property
- prop_no_thunks ∷ NoThunks a ⇒ a → Property
- prop_no_thunks_IO ∷ NoThunks a ⇒ IO a → IO Property
- prop_no_thunks_IO_from ∷ NoThunks a ⇒ (b → IO a) → b → Property
- prop_no_thunks_IO_with ∷ NoThunks a ⇒ Gen (IO a) → Property
- newtype TestSeed = TestSeed {}
- withTestSeed ∷ TestSeed → MonadPseudoRandom ChaChaDRG a → a
- testSeedToChaCha ∷ TestSeed → ChaChaDRG
- nullTestSeed ∷ TestSeed
- data SizedSeed (n ∷ Nat)
- unSizedSeed ∷ SizedSeed n → Seed
- arbitrarySeedOfSize ∷ Word → Gen Seed
- arbitrarySeedBytesOfSize ∷ Word → Gen ByteString
- prop_keygen_context_changes_verkey ∷ ∀ v. (DSIGNAlgorithm v, Eq (KeyGenContextDSIGN v), Show (KeyGenContextDSIGN v)) ⇒ Proxy v → Gen (KeyGenContextDSIGN v) → SizedSeed (SeedSizeDSIGN v) → Property
- newtype Message = Message {}
- data BadInputFor (a ∷ Type)
- genBadInputFor ∷ ∀ (a ∷ Type). Int → Gen (BadInputFor a)
- shrinkBadInputFor ∷ ∀ (a ∷ Type). BadInputFor a → [BadInputFor a]
- showBadInputFor ∷ ∀ (a ∷ Type). BadInputFor a → String
- hexBS ∷ ByteString → String
- noExceptionsThrown ∷ Applicative m ⇒ m Property
- doesNotThrow ∷ Applicative m ⇒ m a → m Property
- directSerialiseToBS ∷ ∀ m a. DirectSerialise a ⇒ MonadST m ⇒ MonadThrow m ⇒ Int → a → m ByteString
- directDeserialiseFromBS ∷ ∀ m a. DirectDeserialise a ⇒ MonadST m ⇒ MonadThrow m ⇒ ByteString → m a
- eitherShowError ∷ (HasCallStack, Show e) ⇒ Either e a → IO a
- data Lock
- withLock ∷ Lock → IO a → IO a
- mkLock ∷ IO Lock
CBOR
class Typeable a ⇒ FromCBOR a where Source #
Instances
class Typeable a ⇒ ToCBOR a where Source #
Minimal complete definition
Methods
toCBOR ∷ a → Encoding Source #
encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy a → Size Source #
Instances
prop_cbor_size ∷ ∀ a. ToCBOR a ⇒ a → Property Source #
prop_cbor_fixed_sized ∷ (FixedSizeCodec a, Eq a, Show a) ⇒ a → Property Source #
prop_cbor_valid ∷ (a → Encoding) → a → Property Source #
prop_raw_serialise ∷ (Eq a, Show a) ⇒ (a → ByteString) → (ByteString → Maybe a) → a → Property Source #
prop_raw_serialise_fixed_sized ∷ (Eq a, Show a, FixedSizeCodec a) ⇒ a → Property Source #
prop_raw_deserialise ∷ ∀ (a ∷ Type). Show a ⇒ (ByteString → Maybe a) → BadInputFor a → Property Source #
prop_raw_deserialise_fixed_sized ∷ ∀ (a ∷ Type). (FixedSizeCodec a, Show a) ⇒ BadInputFor a → Property Source #
prop_size_serialise ∷ (a → ByteString) → Word → a → Property Source #
prop_size_serialise_fixed_sized ∷ ∀ a. FixedSizeCodec a ⇒ a → Property Source #
prop_cbor_fixed_sized_vs_class ∷ (FixedSizeCodec a, ToCBOR a) ⇒ a → Property Source #
prop_bad_cbor_bytes ∷ ∀ (a ∷ Type). (Show a, FromCBOR a) ⇒ BadInputFor a → Property Source #
NoThunks
prop_no_thunks ∷ NoThunks a ⇒ a → Property Source #
When forcing the given value to WHNF, it may no longer contain thunks.
Test Seed
withTestSeed ∷ TestSeed → MonadPseudoRandom ChaChaDRG a → a Source #
Seeds
unSizedSeed ∷ SizedSeed n → Seed Source #
Keygen
prop_keygen_context_changes_verkey ∷ ∀ v. (DSIGNAlgorithm v, Eq (KeyGenContextDSIGN v), Show (KeyGenContextDSIGN v)) ⇒ Proxy v → Gen (KeyGenContextDSIGN v) → SizedSeed (SeedSizeDSIGN v) → Property Source #
For algorithms where key generation depends on a keygen context: using the same seed but different keygen contexts should yield different verification keys.
test messages for signings
Constructors
| Message | |
Fields | |
Test generation and shrinker helpers
data BadInputFor (a ∷ Type) Source #
Instances
genBadInputFor ∷ ∀ (a ∷ Type). Int → Gen (BadInputFor a) Source #
shrinkBadInputFor ∷ ∀ (a ∷ Type). BadInputFor a → [BadInputFor a] Source #
showBadInputFor ∷ ∀ (a ∷ Type). BadInputFor a → String Source #
Formatting
hexBS ∷ ByteString → String Source #
Helpers for testing IO actions
noExceptionsThrown ∷ Applicative m ⇒ m Property Source #
Return a property that always succeeds in some monad (typically IO).
This is useful to express that we are only interested in whether the side
effects of the preceding actions caused any exceptions or not - if they
did, then the test will fail because of it, but if they did not, then
noExceptionsThrown will be reached, and the test will succeed.
doesNotThrow ∷ Applicative m ⇒ m a → m Property Source #
Chain monadic action with noExceptionsThrown to express that we only
want to make sure that the action does not throw any exceptions, but we are
not interested in its result.
Direct ser/deser helpers
directSerialiseToBS ∷ ∀ m a. DirectSerialise a ⇒ MonadST m ⇒ MonadThrow m ⇒ Int → a → m ByteString Source #
directDeserialiseFromBS ∷ ∀ m a. DirectDeserialise a ⇒ MonadST m ⇒ MonadThrow m ⇒ ByteString → m a Source #
Error handling
eitherShowError ∷ (HasCallStack, Show e) ⇒ Either e a → IO a Source #