{-# LANGUAGE TemplateHaskell #-} module Test.Cardano.Crypto.Random ( tests, ) where import Cardano.Crypto.Random (deterministic, randomNumber) import Cardano.Prelude import qualified Data.ByteString as BS import Hedgehog (Property, checkParallel, discover, property, withTests, (===)) 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 discover prop_randomNumberDeterminism :: Property prop_randomNumberDeterminism :: Property prop_randomNumberDeterminism = TestLimit -> Property -> Property withTests TestLimit 1 (Property -> Property) -> (PropertyT IO () -> Property) -> PropertyT IO () -> Property 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 . HasCallStack => PropertyT IO () -> Property PropertyT IO () -> Property property (PropertyT IO () -> Property) -> PropertyT IO () -> Property forall a b. (a -> b) -> a -> b $ do let seed :: ByteString seed = [Word8] -> ByteString BS.pack [Word8 1 .. Word8 40] ByteString -> MonadPseudoRandom ChaChaDRG Integer -> Integer forall a. ByteString -> MonadPseudoRandom ChaChaDRG a -> a deterministic ByteString seed (Integer -> MonadPseudoRandom ChaChaDRG Integer forall (m :: * -> *). MonadRandom m => Integer -> m Integer randomNumber Integer 1) Integer -> Integer -> PropertyT IO () forall (m :: * -> *) a. (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () === Integer 0