mutagen-0.1.0.0: Property-based testing framework for Haskell using type-preserving mutations.
Safe HaskellNone
LanguageHaskell2010

Test.Mutagen.Property

Description

Combinators for constructing and running properties.

Synopsis

Property arguments

type IsArgs a = (Show a, Eq a, Ord a, Typeable a, Arbitrary a, Fragmentable a, Mutable a, Lazy a) Source #

Constraints needed for types that can be used as property arguments.

data Args Source #

Test arguments hidden behind an existential.

Constructors

IsArgs a => Args a 

Instances

Instances details
Show Args Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

showsPrec :: Int -> Args -> ShowS #

show :: Args -> String #

showList :: [Args] -> ShowS #

Eq Args Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

(==) :: Args -> Args -> Bool #

(/=) :: Args -> Args -> Bool #

Ord Args Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

compare :: Args -> Args -> Ordering #

(<) :: Args -> Args -> Bool #

(<=) :: Args -> Args -> Bool #

(>) :: Args -> Args -> Bool #

(>=) :: Args -> Args -> Bool #

max :: Args -> Args -> Args #

min :: Args -> Args -> Args #

Fragmentable Args Source # 
Instance details

Defined in Test.Mutagen.Property

Lazy Args Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

lazy :: Args -> Args Source #

lazyNode :: Pos -> Args -> Args Source #

Mutable Args Source # 
Instance details

Defined in Test.Mutagen.Property

data Result Source #

Result of executing a property.

Constructors

Result 

Fields

Instances

Instances details
Show Result Source # 
Instance details

Defined in Test.Mutagen.Property

IsProp Result Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: Result -> Prop Source #

pattern Passed :: Result Source #

Pattern synonyms for a successful Result.

pattern Failed :: Result Source #

Pattern synonyms for a failed Result.

pattern Discarded :: Result Source #

Pattern synonyms for a discarded Result.

data Prop Source #

Executable properties as IO computations producing results.

Instances

Instances details
IsProp Prop Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: Prop -> Prop Source #

unProp :: Prop -> IO Result Source #

Extract the IO computation from a Prop.

mapProp :: (Result -> Result) -> Prop -> Prop Source #

Map a function over the result of a prop.

protectProp :: Prop -> Prop Source #

Protect a prop against exceptions during evaluation.

(==>) :: IsProp a => Bool -> a -> Prop infixr 2 Source #

Implication combinator for properties.

discardAfter :: IsProp a => Int -> a -> Prop Source #

Discard a property if it takes more than some milliseconds.

class IsProp a where Source #

Types that can produce props.

Methods

prop :: a -> Prop Source #

Instances

Instances details
IsProp Prop Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: Prop -> Prop Source #

IsProp Result Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: Result -> Prop Source #

IsProp Bool Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: Bool -> Prop Source #

IsProp a => IsProp (IO a) Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

prop :: IO a -> Prop Source #

data Property Source #

Properties encapsulating generators of arguments and runner functions.

Constructors

Property (Gen Args) (Args -> Prop) 

Instances

Instances details
Testable Property Source #

Properties are trivially testable.

Instance details

Defined in Test.Mutagen.Property

mapProperty :: (Prop -> Prop) -> Property -> Property Source #

Map a function over the inner executable Prop of a property.

forAll :: (IsArgs a, IsProp b) => Gen a -> (a -> b) -> Property Source #

Universal quantification over generated arguments.

expectFailure :: Testable prop => prop -> Property Source #

Expect a property to fail.

class Testable a where Source #

A class for testable properties.

Methods

property :: a -> Property Source #

Instances

Instances details
Testable Property Source #

Properties are trivially testable.

Instance details

Defined in Test.Mutagen.Property

Testable Bool Source # 
Instance details

Defined in Test.Mutagen.Property

(IsArgs a, IsProp b) => Testable (a -> b) Source #

Testable properties with one argument.

Instance details

Defined in Test.Mutagen.Property

Methods

property :: (a -> b) -> Property Source #