Copyright | (c) Ivan Perez 2017-2022 |
---|---|
License | BSD-style (see the LICENSE file in the distribution) |
Maintainer | ivan.perez@keera.co.uk |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- generateStream :: Arbitrary a => Distribution -> Range -> Length -> Gen (SignalSampleStream a)
- generateStreamWith :: Arbitrary a => (Int -> DTime -> Gen a) -> Distribution -> Range -> Length -> Gen (SignalSampleStream a)
- data Distribution
- = DistConstant
- | DistNormal (DTime, DTime)
- | DistRandom
- type Range = (Maybe DTime, Maybe DTime)
- type Length = Maybe (Either Int DTime)
- uniDistStream :: Arbitrary a => Gen (SignalSampleStream a)
- uniDistStreamMaxDT :: Arbitrary a => DTime -> Gen (SignalSampleStream a)
- fixedDelayStream :: Arbitrary a => DTime -> Gen (SignalSampleStream a)
- fixedDelayStreamWith :: Arbitrary a => (DTime -> a) -> DTime -> Gen (SignalSampleStream a)
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.
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.