Module

Test.StrongCheck.Perturb

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

#Attempts Source

newtype Attempts

Constructors

#Perturb Source

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 Source

newtype Perturber a

Constructors

Instances

#PerturberRec Source

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

#perturberProduct Source

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

Combines two perturbers to produce a perturber of the product

#(</\>) Source

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

#perturberSum Source

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

Combines two perturbers to produce a perturber of the sum

#(<\/>) Source

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

#bounded Source

bounded :: Number -> Number -> Perturber Number

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

#boundedInt Source

boundedInt :: Int -> Int -> Perturber Int

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

#dist Source

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

#dims Source

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

#enumerated Source

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

#nonPerturber Source

nonPerturber :: forall a. Perturber a

Creates a perturber that perturbs nothing.

#perturb Source

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

#searchIn' Source

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 Source

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 Source

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