foundation-0.0.30: Alternative prelude with batteries and no dependencies
LicenseBSD-style
MaintainerFoundation maintainers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Foundation.Check

Description

An implementation of a test framework and property expression & testing

Synopsis

Documentation

data Gen a Source #

Generator monad

Instances

Instances details
Applicative Gen Source # 
Instance details

Defined in Foundation.Check.Gen

Methods

pure :: a -> Gen a #

(<*>) :: Gen (a -> b) -> Gen a -> Gen b #

liftA2 :: (a -> b -> c) -> Gen a -> Gen b -> Gen c #

(*>) :: Gen a -> Gen b -> Gen b #

(<*) :: Gen a -> Gen b -> Gen a #

Functor Gen Source # 
Instance details

Defined in Foundation.Check.Gen

Methods

fmap :: (a -> b) -> Gen a -> Gen b #

(<$) :: a -> Gen b -> Gen a #

Monad Gen Source # 
Instance details

Defined in Foundation.Check.Gen

Methods

(>>=) :: Gen a -> (a -> Gen b) -> Gen b #

(>>) :: Gen a -> Gen b -> Gen b #

return :: a -> Gen a #

class Arbitrary a where Source #

How to generate an arbitrary value for a

Methods

arbitrary :: Gen a Source #

Instances

Instances details
Arbitrary Int16 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Int32 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Int64 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Int8 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word16 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word32 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word64 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word8 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary AsciiString Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Char7 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word128 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word256 Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary String Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Arbitrary Integer Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Natural Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Bool Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Char Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Double Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Float Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Int Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Arbitrary Word Source # 
Instance details

Defined in Foundation.Check.Arbitrary

KnownNat n => Arbitrary (Zn n) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (Zn n) Source #

(NatWithinBound Word64 n, KnownNat n) => Arbitrary (Zn64 n) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (Zn64 n) Source #

Arbitrary (CountOf ty) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (CountOf ty) Source #

Arbitrary a => Arbitrary (Maybe a) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (Maybe a) Source #

Arbitrary a => Arbitrary [a] Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen [a] Source #

(Arbitrary l, Arbitrary r) => Arbitrary (Either l r) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (Either l r) Source #

(Arbitrary a, KnownNat n, NatWithinBound Int n) => Arbitrary (ListN n a) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (ListN n a) Source #

(Arbitrary a, Arbitrary b) => Arbitrary (a, b) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (a, b) Source #

(Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (a, b, c) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (a, b, c) Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => Arbitrary (a, b, c, d) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d) Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e) => Arbitrary (a, b, c, d, e) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e) Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f) => Arbitrary (a, b, c, d, e, f) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f) Source #

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

Call one of the generator weighted

data Test where Source #

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 Source #

Name of a test

Property

data PropertyCheck Source #

The type of check this test did for a property

Instances

Instances details
IsProperty PropertyCheck Source # 
Instance details

Defined in Foundation.Check.Property

data Property Source #

Constructors

Prop 

Fields

Instances

Instances details
IsProperty Property Source # 
Instance details

Defined in Foundation.Check.Property

class IsProperty p where Source #

Methods

property :: p -> Property Source #

Instances

Instances details
IsProperty Property Source # 
Instance details

Defined in Foundation.Check.Property

IsProperty PropertyCheck Source # 
Instance details

Defined in Foundation.Check.Property

IsProperty Bool Source # 
Instance details

Defined in Foundation.Check.Property

IsProperty (String, Bool) Source # 
Instance details

Defined in Foundation.Check.Property

(Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) Source # 
Instance details

Defined in Foundation.Check.Property

Methods

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

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

A property that check for equality of its 2 members.

propertyCompare Source #

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

propertyCompareWith Source #

Arguments

:: String

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

-> (a -> a -> Bool)

function used for value comparaison

-> (a -> String)

function used to pretty print the values

-> 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 and a given method to pretty print the values.

propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck Source #

A conjuctive property composed of 2 properties that need to pass

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

Running a generator for a specific type under a property

Check Plan

data Check a Source #

Instances

Instances details
Applicative Check Source # 
Instance details

Defined in Foundation.Check.Types

Methods

pure :: a -> Check a #

(<*>) :: Check (a -> b) -> Check a -> Check b #

liftA2 :: (a -> b -> c) -> Check a -> Check b -> Check c #

(*>) :: Check a -> Check b -> Check b #

(<*) :: Check a -> Check b -> Check a #

Functor Check Source # 
Instance details

Defined in Foundation.Check.Types

Methods

fmap :: (a -> b) -> Check a -> Check b #

(<$) :: a -> Check b -> Check a #

Monad Check Source # 
Instance details

Defined in Foundation.Check.Types

Methods

(>>=) :: Check a -> (a -> Check b) -> Check b #

(>>) :: Check a -> Check b -> Check b #

return :: a -> Check a #

MonadState Check Source # 
Instance details

Defined in Foundation.Check.Types

Associated Types

type State Check Source #

Methods

withState :: (State Check -> (a, State Check)) -> Check a Source #

type State Check Source # 
Instance details

Defined in Foundation.Check.Types

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

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

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