Skip to content

jutaro/purescript-quickcheck

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module Documentation

Module Test.QuickCheck

Arbitrary

class Arbitrary t where
  arbitrary :: Gen t

CoArbitrary

class CoArbitrary t where
  coarbitrary :: forall r. t -> Gen r -> Gen r

Result

data Result
  = Success 
  | Failed String

showResult

instance showResult :: Show Result

(<?>)

(<?>) :: Boolean -> String -> Result

arbChar

instance arbChar :: Arbitrary S.Char

coarbChar

instance coarbChar :: CoArbitrary S.Char

arbNumber

instance arbNumber :: Arbitrary Number

coarbNumber

instance coarbNumber :: CoArbitrary Number

arbBoolean

instance arbBoolean :: Arbitrary Boolean

coarbBoolean

instance coarbBoolean :: CoArbitrary Boolean

arbString

instance arbString :: Arbitrary String

coarbString

instance coarbString :: CoArbitrary String

AlphaNumString

newtype AlphaNumString
  = AlphaNumString String

arbAlphaNumString

instance arbAlphaNumString :: Arbitrary AlphaNumString

coarbAlphaNumString

instance coarbAlphaNumString :: CoArbitrary AlphaNumString

arbTuple

instance arbTuple :: (Arbitrary a, Arbitrary b) => Arbitrary (Tuple a b)

coarbTuple

instance coarbTuple :: (CoArbitrary a, CoArbitrary b) => CoArbitrary (Tuple a b)

arbEither

instance arbEither :: (Arbitrary a, Arbitrary b) => Arbitrary (Either a b)

coarbEither

instance coarbEither :: (CoArbitrary a, CoArbitrary b) => CoArbitrary (Either a b)

arbMaybe

instance arbMaybe :: (Arbitrary a) => Arbitrary (Maybe a)

coarbMaybe

instance coarbMaybe :: (CoArbitrary a) => CoArbitrary (Maybe a)

arbFunction

instance arbFunction :: (CoArbitrary a, Arbitrary b) => Arbitrary (a -> b)

coarbFunction

instance coarbFunction :: (Arbitrary a, CoArbitrary b) => CoArbitrary (a -> b)

arbArray

instance arbArray :: (Arbitrary a) => Arbitrary [a]

coarbArray

instance coarbArray :: (CoArbitrary a) => CoArbitrary [a]

Testable

class Testable prop where
  test :: prop -> Gen Result

testableResult

instance testableResult :: Testable Result

testableBoolean

instance testableBoolean :: Testable Boolean

testableFunction

instance testableFunction :: (Arbitrary t, Testable prop) => Testable (t -> prop)

quickCheckPure

quickCheckPure :: forall prop. (Testable prop) => Number -> Number -> prop -> [Result]

QC

type QC a = forall eff. Eff (err :: Exception, random :: Random, trace :: Trace | eff) a

quickCheck'

quickCheck' :: forall prop. (Testable prop) => Number -> prop -> QC Unit

quickCheck

quickCheck :: forall prop. (Testable prop) => prop -> QC Unit

(===)

(===) :: forall a b. (Eq a, Show a) => a -> a -> Result

Self-documenting equality assertion

(/==)

(/==) :: forall a b. (Eq a, Show a) => a -> a -> Result

Self-documenting inequality assertion

Module Test.QuickCheck.Gen

LCG

type LCG = Number

Size

type Size = Number

GenState

type GenState = { size :: Size, newSeed :: LCG }

GenOut

type GenOut a = { value :: a, state :: GenState }

Gen

data Gen a

repeatable

repeatable :: forall a b. (a -> Gen b) -> Gen (a -> b)

stateful

stateful :: forall a. (GenState -> Gen a) -> Gen a

variant

variant :: forall a. LCG -> Gen a -> Gen a

sized

sized :: forall a. (Size -> Gen a) -> Gen a

resize

resize :: forall a. Size -> Gen a -> Gen a

choose

choose :: Number -> Number -> Gen Number

chooseInt

chooseInt :: Number -> Number -> Gen Number

oneOf

oneOf :: forall a. Gen a -> [Gen a] -> Gen a

frequency

frequency :: forall a. Tuple Number (Gen a) -> [Tuple Number (Gen a)] -> Gen a

arrayOf

arrayOf :: forall a. Gen a -> Gen [a]

arrayOf1

arrayOf1 :: forall a. Gen a -> Gen (Tuple a [a])

vectorOf

vectorOf :: forall a. Number -> Gen a -> Gen [a]

elements

elements :: forall a. a -> [a] -> Gen a

runGen

runGen :: forall a. Gen a -> GenState -> GenOut a

evalGen

evalGen :: forall a. Gen a -> GenState -> a

showSample'

showSample' :: forall r a. (Show a) => Size -> Gen a -> Eff (trace :: Trace | r) Unit

showSample

showSample :: forall r a. (Show a) => Gen a -> Eff (trace :: Trace | r) Unit

uniform

uniform :: Gen Number

perturbGen

perturbGen :: forall a. Number -> Gen a -> Gen a

functorGen

instance functorGen :: Functor Gen

applyGen

instance applyGen :: Apply Gen

applicativeGen

instance applicativeGen :: Applicative Gen

bindGen

instance bindGen :: Bind Gen

monadGen

instance monadGen :: Monad Gen

About

A very basic implementation of QuickCheck in PureScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PureScript 92.7%
  • JavaScript 7.3%