Module

Test.StrongCheck.Perturb

#Attempts

newtype Attempts

Constructors

#Perturb

class Perturb a  where

The class for things which can be perturbed.

Laws: forall a, 0 >= n <= 1: ((>=) n) <<< dist a <$> (perturb n a) must be an infinite generator of true values.

Members

Instances

#Perturber

newtype Perturber a

Constructors

Instances

#PerturberRec

type PerturberRec a = { perturb :: Number -> a -> Gen a, dist :: a -> a -> Number, dims :: a -> Number }

#perturberProduct

perturberProduct :: forall a b. Perturber a -> Perturber b -> Perturber (Tuple a b)

Combines two perturbers to produce a perturber of the product

#(</\>)

Operator alias for Test.StrongCheck.Perturb.perturberProduct (right-associative / precedence 6)

#perturberSum

perturberSum :: forall a b. Perturber a -> Perturber b -> Perturber (Either a b)

Combines two perturbers to produce a perturber of the sum

#(<\/>)

Operator alias for Test.StrongCheck.Perturb.perturberSum (right-associative / precedence 6)

#bounded

bounded :: Number -> Number -> Perturber Number

Creates a perturber for numbers that fall within the specified range.

#boundedInt

boundedInt :: Int -> Int -> Perturber Int

Creates a perturber for integers that fall within the specified range.

#dist

dist :: forall a. Perturb a => a -> a -> Number

#dims

dims :: forall a. Perturb a => a -> Number

#enumerated

enumerated :: forall a. Eq a => a -> Array a -> Perturber a

#nonPerturber

nonPerturber :: forall a. Perturber a

Creates a perturber that perturbs nothing.

#perturb

perturb :: forall a. Perturb a => Number -> a -> Gen a

#searchIn'

searchIn' :: forall a. Perturb a => Attempts -> Int -> (a -> Boolean) -> a -> Gen a

Given one example, searches for other examples that satisfy a provided boolean predicate.

The search operates out-to-in, in an attempt to find examples that are as far removed from the provided example as possible. The sampling size parameter determines how many samples to take at every level of searching, while the attempts parameter determines how many levels.

#searchIn

searchIn :: forall a. Perturb a => (a -> Boolean) -> a -> Gen a

The same as search', but uses defaults for attempt count and sample size. Will search a total of 10,000 examples before giving up.

#unPerturber

unPerturber :: forall a. Perturber a -> PerturberRec a

Modules