| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Falsify.Interactive
Description
Utilities for interaction with falsify in ghci
Synopsis
- falsify :: Property' e a -> IO (Maybe e)
- falsify' :: Property' e a -> IO (Maybe (NonEmpty e))
- sample :: Gen a -> IO a
- sampleUsing :: ReplaySeed -> Gen a -> a
- shrink :: (a -> Bool) -> Gen a -> IO (Maybe a)
- shrink' :: forall e a. (a -> Maybe e) -> Gen a -> IO (Maybe (NonEmpty e))
- data ReplaySeed = ReplaySeed {}
Top-level driver
falsify :: Property' e a -> IO (Maybe e) Source #
Try to falsify the given property
Reports the counter-example, if we find any.
falsify' :: Property' e a -> IO (Maybe (NonEmpty e)) Source #
Generalization of falsify that reports the full shrink history
Investigating generators
sampleUsing :: ReplaySeed -> Gen a -> a Source #
Sample generator using the specified seed
shrink :: (a -> Bool) -> Gen a -> IO (Maybe a) Source #
Shrink counter-example
This will run the generator repeatedly until it finds a counter-example to the given property, and will then shrink it.
Returns Nothing if no counter-example could be found.
shrink' :: forall e a. (a -> Maybe e) -> Gen a -> IO (Maybe (NonEmpty e)) Source #
Generalization of shrink. Returns the full shrink history.
Re-exports
data ReplaySeed Source #
Replay seed
By default, when we falsify a property we start with a PRNG initialized using
a random seed (produced using the system entropy; this relies on
initSMGen in splitmix). When a property fails,
we will report the exact seed used, so that the user can re-run the exact
same test again, if desired.
The definition of ReplaySeed is part of falsify's public API, to make it
possible to use custom drivers.
Constructors
| ReplaySeed | |
Fields
| |
Instances
| IsString ReplaySeed Source # | |
Defined in Test.Falsify.Internal.Driver.ReplaySeed Methods fromString :: String -> ReplaySeed # | |
| Show ReplaySeed Source # | |
Defined in Test.Falsify.Internal.Driver.ReplaySeed Methods showsPrec :: Int -> ReplaySeed -> ShowS # show :: ReplaySeed -> String # showList :: [ReplaySeed] -> ShowS # | |
| Binary ReplaySeed Source # | |
Defined in Test.Falsify.Internal.Driver.ReplaySeed | |