{-# 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 = forall (m :: * -> *). MonadIO m => Group -> m Bool checkParallel $$String [(PropertyName, Property)] Property String -> PropertyName String -> GroupName GroupName -> [(PropertyName, Property)] -> Group discover prop_randomNumberDeterminism :: Property prop_randomNumberDeterminism :: Property prop_randomNumberDeterminism = TestLimit -> Property -> Property withTests TestLimit 1 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 property forall a b. (a -> b) -> a -> b $ do let seed :: ByteString seed = [Word8] -> ByteString BS.pack [Word8 1 .. Word8 40] forall a. ByteString -> MonadPseudoRandom ChaChaDRG a -> a deterministic ByteString seed (forall (m :: * -> *). MonadRandom m => Integer -> m Integer randomNumber Integer 1) forall (m :: * -> *) a. (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () === Integer 0