falsify-0.4.0: Property-based testing with internal integrated shrinking
Safe HaskellNone
LanguageHaskell2010

Test.Falsify.Interactive

Description

Utilities for interaction with falsify in ghci

Synopsis

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

sample :: Gen a -> IO a Source #

Sample generator

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