yampa-test-0.13.3: Testing library for Yampa.
Safe HaskellNone
LanguageHaskell2010

FRP.Yampa.QuickCheck

Description

QuickCheck generators for input streams.

Random stream generation can be customized usin three parameters:

  • The distribution for the random time deltas (Distribution).
  • The maximum and minimum bounds for the time deltas (Range).
  • The maximum stream length (Length).

The main function to generate streams is generateStream. The specific time deltas can be customized further using generateStreamWith. Some helper functions are provided to facilitate testing.

Synopsis

Random stream generation

generateStream :: Arbitrary a => Distribution -> Range -> Length -> Gen (SignalSampleStream a) Source #

Generate random stream.

generateStreamWith :: Arbitrary a => (Int -> DTime -> Gen a) -> Distribution -> Range -> Length -> Gen (SignalSampleStream a) Source #

Generate random stream, parameterized by the value generator.

Parameters used to generate random input streams

data Distribution Source #

Distributions used for time delta (DT) generation.

Constructors

DistConstant

Constant DT for the whole stream.

DistNormal (DTime, DTime)

Variable DT following normal distribution, with an average and a standard deviation.

DistRandom

Completely random (positive) DT.

type Range = (Maybe DTime, Maybe DTime) Source #

Upper and lower bounds of time deltas for random DT generation.

type Length = Maybe (Either Int DTime) Source #

Optional maximum length for a stream, given as a time, or a number of samples.

Helpers for common cases

uniDistStream :: Arbitrary a => Gen (SignalSampleStream a) Source #

Generate a stream of values with uniformly distributed time deltas.

uniDistStreamMaxDT :: Arbitrary a => DTime -> Gen (SignalSampleStream a) Source #

Generate a stream of values with uniformly distributed time deltas, with a max DT.

fixedDelayStream :: Arbitrary a => DTime -> Gen (SignalSampleStream a) Source #

Generate a stream of values with a fixed time delta.

fixedDelayStreamWith :: Arbitrary a => (DTime -> a) -> DTime -> Gen (SignalSampleStream a) Source #

Generate a stream of values with a fixed time delta.