Gen

zio.test.Gen
See theGen companion object
final case class Gen[-R, +A](sample: ZStream[R, Nothing, Sample[R, A]])

A Gen[R, A] represents a generator of values of type A, which requires an environment R. Generators may be random or deterministic.

Attributes

Companion
object
Source
Gen.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
Gen[R, A]

Members list

Value members

Concrete methods

def ++[R1 <: R, A1 >: A](that: Gen[R1, A1])(implicit trace: Trace): Gen[R1, A1]

A symbolic alias for concat.

A symbolic alias for concat.

Attributes

Source
Gen.scala
def <*>[R1 <: R, B](that: Gen[R1, B])(implicit zippable: Zippable[A, B], trace: Trace): Gen[R1, zippable.Out]

A symbolic alias for zip.

A symbolic alias for zip.

Attributes

Source
Gen.scala
def collect[B](pf: PartialFunction[A, B])(implicit trace: Trace): Gen[R, B]

Maps the values produced by this generator with the specified partial function, discarding any values the partial function is not defined at.

Maps the values produced by this generator with the specified partial function, discarding any values the partial function is not defined at.

Attributes

Source
Gen.scala
def concat[R1 <: R, A1 >: A](that: Gen[R1, A1])(implicit trace: Trace): Gen[R1, A1]

Concatenates the specified deterministic generator with this determinstic generator, resulting in a deterministic generator that generates the values from this generator and then the values from the specified generator.

Concatenates the specified deterministic generator with this determinstic generator, resulting in a deterministic generator that generates the values from this generator and then the values from the specified generator.

Attributes

Source
Gen.scala
def filter(f: A => Boolean)(implicit trace: Trace): Gen[R, A]

Filters the values produced by this generator, discarding any values that do not meet the specified predicate. Using filter can reduce test performance, especially if many values must be discarded. It is recommended to use combinators such as map and flatMap to create generators of the desired values instead.

Filters the values produced by this generator, discarding any values that do not meet the specified predicate. Using filter can reduce test performance, especially if many values must be discarded. It is recommended to use combinators such as map and flatMap to create generators of the desired values instead.

val evens: Gen[Any, Int] = Gen.int.map(_ * 2)

Attributes

Source
Gen.scala
def filterNot(f: A => Boolean)(implicit trace: Trace): Gen[R, A]

Filters the values produced by this generator, discarding any values that meet the specified predicate.

Filters the values produced by this generator, discarding any values that meet the specified predicate.

Attributes

Source
Gen.scala
def filterZIO[R1 <: R](f: A => ZIO[R1, Nothing, Boolean])(implicit trace: Trace): Gen[R1, A]

Filters the values produced by this generator, discarding any values that do not meet the specified effectual predicate. Using filterZIO can reduce test performance, especially if many values must be discarded. It is recommended to use combinators such as map and flatMap to create generators of the desired values instead.

Filters the values produced by this generator, discarding any values that do not meet the specified effectual predicate. Using filterZIO can reduce test performance, especially if many values must be discarded. It is recommended to use combinators such as map and flatMap to create generators of the desired values instead.

val evens: Gen[Any, Int] = Gen.int.map(_ * 2)

Attributes

Source
Gen.scala
def flatMap[R1 <: R, B](f: A => Gen[R1, B])(implicit trace: Trace): Gen[R1, B]

Attributes

Source
Gen.scala
def flatten[R1 <: R, B](implicit ev: A <:< Gen[R1, B], trace: Trace): Gen[R1, B]

Attributes

Source
Gen.scala
def map[B](f: A => B)(implicit trace: Trace): Gen[R, B]

Attributes

Source
Gen.scala
def mapZIO[R1 <: R, B](f: A => ZIO[R1, Nothing, B])(implicit trace: Trace): Gen[R1, B]

Maps an effectual function over a generator.

Maps an effectual function over a generator.

Attributes

Source
Gen.scala
def noShrink(implicit trace: Trace): Gen[R, A]

Discards the shrinker for this generator.

Discards the shrinker for this generator.

Attributes

Source
Gen.scala
def reshrink[R1 <: R, B](f: A => Sample[R1, B])(implicit trace: Trace): Gen[R1, B]

Discards the shrinker for this generator and applies a new shrinker by mapping each value to a sample using the specified function. This is useful when the process to shrink a value is simpler than the process used to generate it.

Discards the shrinker for this generator and applies a new shrinker by mapping each value to a sample using the specified function. This is useful when the process to shrink a value is simpler than the process used to generate it.

Attributes

Source
Gen.scala
def resize(size: Int)(implicit trace: Trace): Gen[R, A]

Sets the size parameter for this generator to the specified value.

Sets the size parameter for this generator to the specified value.

Attributes

Source
Gen.scala
def runCollect(implicit trace: Trace): ZIO[R, Nothing, List[A]]

Runs the generator and collects all of its values in a list.

Runs the generator and collects all of its values in a list.

Attributes

Source
Gen.scala
def runCollectN(n: Int)(implicit trace: Trace): ZIO[R, Nothing, List[A]]

Repeatedly runs the generator and collects the specified number of values in a list.

Repeatedly runs the generator and collects the specified number of values in a list.

Attributes

Source
Gen.scala
def runHead(implicit trace: Trace): ZIO[R, Nothing, Option[A]]

Runs the generator returning the first value of the generator.

Runs the generator returning the first value of the generator.

Attributes

Source
Gen.scala
def withFilter(f: A => Boolean)(implicit trace: Trace): Gen[R, A]

Attributes

Source
Gen.scala
def zip[R1 <: R, B](that: Gen[R1, B])(implicit zippable: Zippable[A, B], trace: Trace): Gen[R1, zippable.Out]

Composes this generator with the specified generator to create a cartesian product of elements.

Composes this generator with the specified generator to create a cartesian product of elements.

Attributes

Source
Gen.scala
def zipWith[R1 <: R, B, C](that: Gen[R1, B])(f: (A, B) => C)(implicit trace: Trace): Gen[R1, C]

Composes this generator with the specified generator to create a cartesian product of elements with the specified function.

Composes this generator with the specified generator to create a cartesian product of elements with the specified function.

Attributes

Source
Gen.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product