{-# LANGUAGE TemplateHaskell #-}
module Test.Cardano.Crypto.Signing.Redeem.Compact (
tests,
) where
import Cardano.Crypto.Signing.Redeem (
fromCompactRedeemVerificationKey,
toCompactRedeemVerificationKey,
)
import Cardano.Prelude
import Hedgehog (MonadTest, Property, checkParallel, tripping)
import Test.Cardano.Crypto.Gen (genRedeemVerificationKey)
import Test.Cardano.Prelude
roundTripCompactRedeemVerificationKey :: Property
roundTripCompactRedeemVerificationKey :: Property
roundTripCompactRedeemVerificationKey =
TestLimit
-> Gen RedeemVerificationKey
-> (RedeemVerificationKey -> PropertyT IO ())
-> Property
forall a.
(Show a, HasCallStack) =>
TestLimit -> Gen a -> (a -> PropertyT IO ()) -> Property
eachOf
TestLimit
1000
Gen RedeemVerificationKey
genRedeemVerificationKey
((RedeemVerificationKey -> CompactRedeemVerificationKey)
-> (CompactRedeemVerificationKey -> RedeemVerificationKey)
-> RedeemVerificationKey
-> PropertyT IO ()
forall (m :: * -> *) a b.
(HasCallStack, MonadTest m, Show a, Show b, Eq a) =>
(a -> b) -> (b -> a) -> a -> m ()
trippingCompact RedeemVerificationKey -> CompactRedeemVerificationKey
toCompactRedeemVerificationKey CompactRedeemVerificationKey -> RedeemVerificationKey
fromCompactRedeemVerificationKey)
trippingCompact ::
(HasCallStack, MonadTest m, Show a, Show b, Eq a) =>
(a -> b) ->
(b -> a) ->
a ->
m ()
trippingCompact :: forall (m :: * -> *) a b.
(HasCallStack, MonadTest m, Show a, Show b, Eq a) =>
(a -> b) -> (b -> a) -> a -> m ()
trippingCompact a -> b
toCompact b -> a
fromCompact a
x =
a -> (a -> b) -> (b -> Identity a) -> m ()
forall (m :: * -> *) (f :: * -> *) b a.
(MonadTest m, Applicative f, Show b, Show (f a), Eq (f a),
HasCallStack) =>
a -> (a -> b) -> (b -> f a) -> m ()
tripping a
x a -> b
toCompact (a -> Identity a
forall a. a -> Identity a
Identity (a -> Identity a) -> (b -> a) -> b -> Identity a
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. b -> a
fromCompact)
tests :: IO Bool
tests :: IO Bool
tests = Group -> IO Bool
forall (m :: * -> *). MonadIO m => Group -> m Bool
checkParallel $$String
[(PropertyName, Property)]
Property
String -> GroupName
String -> PropertyName
GroupName -> [(PropertyName, Property)] -> Group
discoverRoundTrip