constrained-generators-0.2.0.0: Framework for generating constrained random data using a subset of first order logic
Safe HaskellSafe-Inferred
LanguageHaskell2010

Constrained.Examples.Fold

Synopsis

Documentation

evenSpec ∷ ∀ n. (TypeSpec n ~ NumSpec n, Integral n, HasSpec n, MaybeBounded n) ⇒ Specification n Source #

sum3WithLength ∷ Integer → Specification ([Int], Int, Int, Int) Source #

listSumComplexNumbery a ⇒ a → Specification [a] Source #

Complicated, because if a is too large, the spec is unsatisfiable.

data Outcome Source #

Constructors

Succeed 
Fail 

propYes ∷ String → Solution t → Property Source #

propNo ∷ Show t ⇒ String → Solution t → Property Source #

parensList ∷ [String] → String Source #

picktest ∷ (Ord a, Num a) ⇒ a → a → (a → Bool) → a → Int → [a] → Bool Source #

pickPropGen Property Source #

generate a different category of test, each time.

testFoldSpec ∷ ∀ a. (Foldy a, Random a, Integral a, TypeSpec a ~ NumSpec a, Arbitrary a, MaybeBounded a) ⇒ Specification Integer → Specification a → Specification a → OutcomeGen Property Source #

Build properties about calls to genListWithSize

sumProp ∷ (Integral t, Random t, HasSpec t) ⇒ t → t → Specification t → t → Int → OutcomeGen Property Source #

Generate a property from a call to pickAll. We can test for success or failure using outcome

sumProp2 ∷ (Show t, Integral t, Random t) ⇒ t → t → (String, t → Bool) → t → Int → OutcomeGen Property Source #

Like SumProp, but instead of using a (Specification fn n) for the element predicate It uses an explicit pair of a (String, n -> Bool). This means we can test things using any Haskell function.