Gen

final case class Gen[+A](run: () => A) extends AnyVal
Companion:
object
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def &[B](g: Gen[B]): Gen[(A, B)]
def >>[B](f: Gen[B]): Gen[B]
def arraySeq[B >: A](implicit ct: ClassTag[B], ss: SizeSpec): Gen[ArraySeq[B]]
def arraySeq[B >: A](ss: SizeSpec)(implicit ct: ClassTag[B]): Gen[ArraySeq[B]]
def arraySeq1[B >: A](implicit ct: ClassTag[B], ss: SizeSpec): Gen[ArraySeq[B]]
def arraySeq1[B >: A](ss: SizeSpec)(implicit ct: ClassTag[B]): Gen[ArraySeq[B]]
def catsNEL[B >: A](implicit ss: SizeSpec): Gen[NonEmptyList[B]]
def catsNES[B >: A](implicit ss: SizeSpec, o: Ordering[B]): Gen[Type[B]]
def catsNEV[B >: A](implicit ss: SizeSpec): Gen[NonEmptyVector[B]]
def either[B](g: Gen[B]): Gen[Either[A, B]]
def fill[B](n: Int)(implicit cbf: Factory[A, B]): Gen[B]
def fillFold[B](n: Int, z: B)(f: (B, A) => B): Gen[B]
@inline
def fillFoldSS[B](ss: SizeSpec, z: B)(f: (B, A) => B): Gen[B]
@inline
def fillFoldSS1[B](ss: SizeSpec, z: B)(f: (B, A) => B): Gen[B]
@inline
def fillSS[B](ss: SizeSpec)(implicit cbf: Factory[A, B]): Gen[B]
@inline
def fillSS1[B](ss: SizeSpec)(implicit cbf: Factory[A, B]): Gen[B]
def flatMap[B](f: A => Gen[B]): Gen[B]
def flatten[B](implicit ev: A <:< Gen[B]): Gen[B]
def list(implicit ss: SizeSpec): Gen[List[A]]
def list1(implicit ss: SizeSpec): Gen[List[A]]
def map[B](f: A => B): Gen[B]
def mapBy[K](gk: Gen[K])(implicit ss: SizeSpec): Gen[Map[K, A]]
def mapByEachKey[K](keys: Iterable[K]): Gen[Map[K, A]]
def mapByKeySubset[K](legalKeys: Iterable[K]): Gen[Map[K, A]]
@inline
def mapTo[K >: A, V](gv: Gen[V])(implicit ss: SizeSpec): Gen[Map[K, V]]
def option: Gen[Option[A]]
def optionGet[B](implicit ev: A <:< Option[B]): Gen[B]

Will keep generating options until one is defined, in which case it is returned.

Will keep generating options until one is defined, in which case it is returned.

If a non-empty option still isn't generated after 1000 attempts, an exception will be thrown.

It is recommended that you use this very sparingly. In nearly all cases, the better alternative is to write your generators such that a return value is guaranteed, rather than generating then discarding.

def optionGetLimit[B](maxAttempts: Int)(implicit ev: A <:< Option[B]): Gen[B]
def pair: Gen[(A, A)]
def sample(): A

Produce a sample datum.

Produce a sample datum.

def samples(genSize: GenSize): Iterator[A]

Produce an infinite stream of generated data.

Produce an infinite stream of generated data.

Use .take(n) for a finite number of samples.

def samplesUsing(ctx: GenCtx): Iterator[A]

Produce an infinite stream of generated data.

Produce an infinite stream of generated data.

Use .take(n) for a finite number of samples.

def set[B >: A](implicit ss: SizeSpec): Gen[Set[B]]
def set1[B >: A](implicit ss: SizeSpec): Gen[Set[B]]
def shuffle[C <: (Iterable), B](implicit ev: A <:< C[B], cbf: BuildFrom[C[B], B, C[B]]): Gen[C[B]]
def sizedSet[B >: A](implicit ss: SizeSpec): Gen[Set[B]]

This will ensure that only unique random data is used and that the resulting set has the desired size.

This will ensure that only unique random data is used and that the resulting set has the desired size.

This is dangerous in that it will block until it generates enough unique elements. For example, Gen.bool.sizedSet(3) will never return.

def sizedSet1[B >: A](implicit ss: SizeSpec): Gen[Set[B]]

This will ensure that only unique random data is used and that the resulting set has the desired size.

This will ensure that only unique random data is used and that the resulting set has the desired size.

This is dangerous in that it will block until it generates enough unique elements. For example, Gen.bool.sizedSet1(3) will never return.

def sortedSet[B >: A](implicit ss: SizeSpec, o: Ordering[B]): Gen[SortedSet[B]]
def sortedSet1[B >: A](implicit ss: SizeSpec, o: Ordering[B]): Gen[SortedSet[B]]
def statePut: StateGen[A, Unit]
Implicitly added by GenOpsWithInvariantA

Discard existing state and replace with the result of this generator.

Discard existing state and replace with the result of this generator.

def strengthL[B](b: B): Gen[(B, A)]
def strengthR[B](b: B): Gen[(A, B)]
@inline
def string(implicit ss: SizeSpec): Gen[String]
Implicitly added by _GenCharExt
@inline
def string1(implicit ss: SizeSpec): Gen[String]
Implicitly added by _GenCharExt
def subset[C <: (Iterable), B](implicit ev: A <:< C[B], cbf: Factory[B, C[B]]): Gen[C[B]]
def subset1[C <: (IndexedSeq), B](implicit ev: A <:< C[B], cbf: Factory[B, C[B]]): Gen[C[B]]

Generates a non-empty subset, unless the underlying seq is empty (in which case this returns an empty seq too).

Generates a non-empty subset, unless the underlying seq is empty (in which case this returns an empty seq too).

def take[C <: (Iterable), B](n: SizeSpec)(implicit ev: A <:< C[B], cbf: Factory[B, C[B]]): Gen[C[B]]
def to[B](f: Factory[A, B])(implicit ss: SizeSpec): Gen[B]
def to1[B](f: Factory[A, B])(implicit ss: SizeSpec): Gen[B]
def toStateGen[S]: StateGen[S, A]
Implicitly added by GenOpsWithInvariantA
def triple: Gen[(A, A, A)]
def vector(implicit ss: SizeSpec): Gen[Vector[A]]
def vector1(implicit ss: SizeSpec): Gen[Vector[A]]
def withConstSeed(seed: Long): Gen[A]
def withFilter(p: A => Boolean): Gen[A]
def withOptionalConstSeed(s: Option[Long]): Gen[A]
def withOptionalSeed(s: Option[Long]): Gen[A]
def withSeed(seed: Long): Gen[A]
@inline
def |[B](g: Gen[B]): Gen[Either[A, B]]

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product