GenFromConfig

final class GenFromConfig[T](gen: Gen[T], config: GenConfig, typeName: String)
class Object
trait Matchable
class Any

Value members

Concrete methods

Modify the captured GenConfig using the given function.

Modify the captured GenConfig using the given function.

def head: T

Get the first instance of this generator with the given configuration.

Get the first instance of this generator with the given configuration.

Note:

this is a stateless function and calling this method with the same config will always produce the same result.

An iterator made by attempting to find each next sample after the given number of retries.

An iterator made by attempting to find each next sample after the given number of retries.

Returns:

An iterator that will generate from the given starting seed

Note:

This uses the new pureApply feature only available in ScalaCheck versions >=1.14.x

def nextRandom(rng: Random): T

Get a random element from this generator using the default seed.

Get a random element from this generator using the default seed.

Generators can run out of samples and return empty results. Typically, this will be the result of bad Gen Parameters or having too many suchThat() restrictions that make it difficult to find the next sample.

Effectively the same as calling nextRandom with Iterator.continually, except that the given Random number generator is only used to generate the first seed and all subsequent iterations are produced from Seed.next.

Effectively the same as calling nextRandom with Iterator.continually, except that the given Random number generator is only used to generate the first seed and all subsequent iterations are produced from Seed.next.

Value parameters:
rng

the random number generator used to initialize the seed.

Note:

If you want to provide a consistent Seed, you should use configured to set GenConfig.withSeed and then call iterator.

An iterator made by Iterator.continually calling Gen.sample.

An iterator made by Iterator.continually calling Gen.sample.

Returns:

An iterator of Options which are None if the generator's filters ruled out the sample.

Note:

If the generator has filters, then this method could return None a lot. If you want a safe way to filter the Nones, see iterator

This will use a random seed for each sample. If you want to get the same iterator from the same seed, you would have to use iterator and handle the possible.

def valueFor(seed: Seed): T

Effectively shorthand for .configured(_.withSeed(seed)).head.

Effectively shorthand for .configured(_.withSeed(seed)).head.

Deprecated methods

def getOrThrow: T

Get a random element from this generator using the default seed.

Get a random element from this generator using the default seed.

Generators can run out of samples and return empty results. Typically, this will be the result of bad Gen Parameters or having too many suchThat() restrictions that make it difficult to find the next sample.

Deprecated
See also:
Deprecated

Converts this generator to an Iterator in the obvious (but potentially dangerous) way.

Converts this generator to an Iterator in the obvious (but potentially dangerous) way.

Returns:

An Iterator that returns only the defined samples.

See also:

iterator for a safer, bounded alternative.

Note:

This pulls an item from the generator one at a time, however, if the generator has too many restrictive filters, this can result in an infinite loop.

Deprecated