foundation-0.0.13: Alternative prelude with batteries and no dependencies

LicenseBSD-style
MaintainerFoundation maintainers
Safe HaskellNone
LanguageHaskell2010

Foundation.Check

Contents

Description

An implementation of a test framework and property expression & testing

Synopsis

Documentation

data Gen a

Generator monad

oneof :: NonEmpty [Gen a] -> Gen a

elements :: NonEmpty [a] -> Gen a

frequency :: NonEmpty [(Word, Gen a)] -> Gen a

Call one of the generator weighted

data Test where

different type of tests supported

Constructors

Unit :: String -> IO () -> Test 
Property :: IsProperty prop => String -> prop -> Test 
Group :: String -> [Test] -> Test 
CheckPlan :: String -> Check () -> Test 

testName :: Test -> String

Name of a test

Property

data PropertyCheck

The type of check this test did for a property

data Property

Constructors

Prop 

Fields

unProp :: Gen PropertyTestArg
 

Instances

(===) :: (Show a, Eq a, Typeable a) => a -> a -> PropertyCheck infix 4

A property that check for equality of its 2 members.

propertyCompare

Arguments

:: (Show a, Typeable a) 
=> String

name of the function used for comparaison, e.g. (<)

-> (a -> a -> Bool)

function used for value comparaison

-> a

value left of the operator

-> a

value right of the operator

-> PropertyCheck 

A property that check for a specific comparaison of its 2 members.

This is equivalent to === but with compare

propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck

A conjuctive property composed of 2 properties that need to pass

forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property

Running a generator for a specific type under a property

Check Plan

validate :: IsProperty prop => String -> prop -> Check ()

pick :: String -> IO a -> Check a

iterateProperty :: CountOf TestResult -> GenParams -> (Word64 -> GenRng) -> Property -> IO (PropertyResult, CountOf TestResult)