Module

Test.StrongCheck

Package
purescript-strongcheckDEPRECATED
Repository
purescript-contrib/purescript-strongcheck

#SC Source

type SC eff a = Eff (console :: CONSOLE, exception :: EXCEPTION, random :: RANDOM | eff) a

A type synonym for StrongCheck effects in Eff.

#Result Source

data Result

The result of a property test.

Constructors

Instances

#Testable Source

class Testable prop  where

A class for types that can be treated as a property test result.

Members

Instances

#quickCheck Source

quickCheck :: forall prop eff. Testable prop => prop -> SC eff Unit

Checks the proposition for 100 random values.

#quickCheck' Source

quickCheck' :: forall prop eff. Testable prop => Int -> prop -> SC eff Unit

Checks the proposition for the specified number of random values.

#quickCheckWithSeed Source

quickCheckWithSeed :: forall prop eff. Testable prop => Seed -> Int -> prop -> SC eff Unit

Checks the proposition for the specified number of random values, starting with a specific seed.

#quickCheckPure Source

quickCheckPure :: forall prop. Testable prop => Int -> Seed -> prop -> Array (Tuple Seed Result)

Checks the proposition for the specified number of random values in a pure setting, returning an array of results.

#smallCheck Source

smallCheck :: forall prop eff. Testable prop => prop -> SC eff Unit

Exhaustively checks the proposition for all possible values. Assumes the generator is a finite generator.

#smallCheckPure Source

smallCheckPure :: forall prop. Testable prop => Seed -> prop -> Array (Tuple Seed Result)

Exhaustively checks the proposition for all possible values in a pure setting, returning an array of results. Assumes the generator is a finite generator.

#statCheck Source

statCheck :: forall prop eff. Testable prop => Number -> prop -> SC eff Unit

Checks that the proposition has a certain probability of being true for arbitrary values.

#statCheckPure Source

statCheckPure :: forall prop. Testable prop => Seed -> Number -> prop -> Result

Checks that the proposition has a certain probability of being true for arbitrary values in a pure setting, returning a result.

#assert Source

assert :: forall prop eff. Testable prop => prop -> SC eff Unit

Checks that the specified proposition holds. Useful for unit tests.

#annotate Source

annotate :: Boolean -> String -> Result

Converts a Boolean into a Result by lifting a message into Failed when the boolean is false.

#(<?>) Source

Operator alias for Test.StrongCheck.annotate (non-associative / precedence 1)

#assertEq Source

assertEq :: forall a. Eq a => Show a => a -> a -> Result

Asserts that two values are equal, resulting in a Failure if they are not, with a message showing the values involved.

#(===) Source

Operator alias for Test.StrongCheck.assertEq (non-associative / precedence 2)

#assertNotEq Source

assertNotEq :: forall a. Eq a => Show a => a -> a -> Result

Asserts that two values are not equal, resulting in a Failure if they are, with a message showing the values involved.

#(/==) Source

Operator alias for Test.StrongCheck.assertNotEq (non-associative / precedence 2)

Re-exports from Test.StrongCheck.Arbitrary

#Arbitrary Source

class Arbitrary t  where

The Arbitrary class represents those types whose values can be randomly-generated.

arbitrary uses the Gen monad to express a random generator for the type t. Combinators in the Test.StrongCheck.Gen module can be used to construct random generators.

Members

Instances

#Coarbitrary Source

class Coarbitrary t  where

The Coarbitrary class represents types which appear on the left of an Arbitrary function arrow.

To construct an Arbitrary instance for the type a -> b, we need to use the input of type a to perturb a random generator for b. This is the role of the coarbitrary function.

Coarbitrary instances can be written using the perturbGen function.

Members

Instances

Re-exports from Test.StrongCheck.LCG

#Seed Source

newtype Seed

A seed for the linear congruential generator. We omit a Semiring instance because there is no zero value, as 0 is not an acceptable seed for the generator.

Instances

#mkSeed Source