case class GenT[A](run: (Size, Seed) => Tree[(Seed, Option[A])]) extends Product with Serializable
Generator for random values of A.
- Alphabetic
- By Inheritance
- GenT
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def ensure(p: (A) => Boolean): GenT[A]
Discards the generator if the generated value does not satisfy the predicate.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def filter(p: (A) => Boolean): GenT[A]
Generates a value that satisfies a predicate.
Generates a value that satisfies a predicate.
We keep some state to avoid looping forever. If we trigger these limits then the whole generator is discarded.
- def flatMap[B](f: (A) => GenT[B]): GenT[B]
- def forAll: PropertyT[A]
- def forAllWithLog(f: (A) => Log): PropertyT[A]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lift: PropertyT[A]
- def list(range: Range[Int]): GenT[List[A]]
Generates a list using a 'Range' to determine the length.
- def log(name: Name): PropertyT[A]
*******************************************************************
- def map[B](f: (A) => B): GenT[B]
- def mapTree[B](f: (Tree[(Seed, Option[A])]) => Tree[(Seed, Option[B])]): GenT[B]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def option: GenT[Option[A]]
Generates a 'None' some of the time.
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def prune: GenT[A]
Throw away a generator's shrink tree.
- def resize(size: Size): GenT[A]
Override the size parameter.
Override the size parameter. Returns a generator which uses the given size instead of the runtime-size parameter.
- val run: (Size, Seed) => Tree[(Seed, Option[A])]
- def scale(f: (Size) => Size): GenT[A]
Adjust the size parameter by transforming it with the given function.
- def shrink(f: (A) => List[A]): GenT[A]
Apply a shrinking function to a generator.
- def small: GenT[A]
Make a generator smaller by scaling its size parameter.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def widen[B >: A]: GenT[B]
Widens this generator to produce values of a supertype
BofA.Widens this generator to produce values of a supertype
BofA.GenTis invariant, so aGen[Cat]is not aGen[Animal]even whenCatextendsAnimal. Usewidento combine generators of subtypes into a generator of their common supertype:sealed trait Animal final case class Cat(name: String) extends Animal final case class Dog(name: String) extends Animal // Either name the supertype at each call site: val genAnimal: Gen[Animal] = Gen.choice1(genCat.widen[Animal], genDog.widen[Animal]) // or name it once on the combinator: val genAnimal2: Gen[Animal] = Gen.choice1[Animal](genCat.widen, genDog.widen)
Prefer naming the target type explicitly, as in both examples above. Leaving it fully inferred (e.g.
Gen.choice1(genCat.widen, genDog.widen)) may infer an unintended type such asAnimal with Product with Serializableon Scala 2, while Scala 3 infersAnimal.Sampling and shrinking are unchanged: the widened generator produces exactly the values and shrink tree of the original.
- def withFilter(p: (A) => Boolean): GenT[A]
Generates a value that satisfies a predicate.
Generates a value that satisfies a predicate.
Equivalent to
filterand is used in for-comprehensions.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)