object Gen extends GenTOps with ByteOps with CharacterOps with StringOps
This is _purely_ to make consuming this library a nicer experience, mainly due to Scala's type inference problems and higher kinds.
- Alphabetic
- By Inheritance
- Gen
- StringOps
- CharacterOps
- ByteOps
- GenTOps
- MonadGenOps
- 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
- def alpha: GenT[Char]
Generates an ASCII letter: 'a' to 'z', 'A' to 'Z'
Generates an ASCII letter: 'a' to 'z', 'A' to 'Z'
- Definition Classes
- CharacterOps
- def alphaNum: GenT[Char]
Generates an ASCII letter or digit: 'a' to 'z', 'A' to 'Z', '0' to '9'
Generates an ASCII letter or digit: 'a' to 'z', 'A' to 'Z', '0' to '9'
- Definition Classes
- CharacterOps
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def ascii: GenT[Char]
Generates an ASCII character
Generates an ASCII character
- Definition Classes
- CharacterOps
- def binit: GenT[Char]
Generates an ASCII binit: '0' to '1'
Generates an ASCII binit: '0' to '1'
- Definition Classes
- CharacterOps
- def boolean: GenT[Boolean]
Generates a random boolean.
Generates a random boolean.
_This generator shrinks to 'False'._
- Definition Classes
- GenTOps
- def byte(range: Range[Byte]): GenT[Byte]
- Definition Classes
- GenTOps
- def bytes(range: Range[Int]): GenT[Array[Byte]]
Generates a random 'Array[Byte]', using 'Range' to determine the length.
Generates a random 'Array[Byte]', using 'Range' to determine the length.
_Shrinks down to the ascii characters._
- Definition Classes
- ByteOps
- def char(lo: Char, hi: Char): GenT[Char]
- Definition Classes
- GenTOps
- def choice[A](x: GenT[A], xs: List[GenT[A]]): GenT[A]
Randomly selects one of the generators in the list.
Randomly selects one of the generators in the list.
This generator shrinks towards the first generator in the list.
- Definition Classes
- GenTOps
- def choice1[A](x: GenT[A], xs: GenT[A]*): GenT[A]
Randomly selects one of the generators in the list.
Randomly selects one of the generators in the list.
This generator shrinks towards the first generator in the list.
- Definition Classes
- GenTOps
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def constant[A](x: => A): GenT[A]
Trivial generator that always produces the same element.
Trivial generator that always produces the same element.
- Definition Classes
- GenTOps
- def digit: GenT[Char]
Generates an ASCII digit: '0' to '9'
Generates an ASCII digit: '0' to '9'
- Definition Classes
- CharacterOps
- def discard[A](implicit G: MonadGen[Gen]): Gen[A]
Discards the whole generator.
Discards the whole generator.
- Definition Classes
- MonadGenOps
- def double(range: Range[Double]): GenT[Double]
*******************************************************************
*******************************************************************
- Definition Classes
- GenTOps
- def double_(range: Range[Double]): GenT[Double]
- Definition Classes
- GenTOps
- def element[A](x: A, xs: List[A]): GenT[A]
Randomly selects one of the elements in the list.
Randomly selects one of the elements in the list.
This generator shrinks towards the first element in the list.
- Definition Classes
- GenTOps
- def element1[A](x: A, xs: A*): GenT[A]
Randomly selects one of the elements in the list.
Randomly selects one of the elements in the list.
This generator shrinks towards the first element in the list.
- Definition Classes
- GenTOps
- def elementUnsafe[A](xs: List[A]): GenT[A]
Randomly selects one of the elements in the list.
Randomly selects one of the elements in the list.
This generator shrinks towards the first element in the list.
WARNING: This may throw an exception if the list is empty, please use one of the other
element
variants if possible- Definition Classes
- GenTOps
- def ensure[A](gen: Gen[A], p: (A) => Boolean)(implicit F: Monad[Gen], G: MonadGen[Gen]): Gen[A]
Discards the generator if the generated value does not satisfy the predicate.
Discards the generator if the generated value does not satisfy the predicate.
- Definition Classes
- MonadGenOps
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter[A](gen: Gen[A])(p: (A) => Boolean)(implicit F: Monad[Gen], G: MonadGen[Gen]): Gen[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.
- Definition Classes
- MonadGenOps
- def frequency[A](a: (Int, GenT[A]), l: List[(Int, GenT[A])]): GenT[A]
Uses a weighted distribution to randomly select one of the generators in the list.
Uses a weighted distribution to randomly select one of the generators in the list.
This generator shrinks towards the first generator in the list.
- Definition Classes
- GenTOps
- def frequency1[A](a: (Int, GenT[A]), l: (Int, GenT[A])*): GenT[A]
Uses a weighted distribution to randomly select one of the generators in the list.
Uses a weighted distribution to randomly select one of the generators in the list.
This generator shrinks towards the first generator in the list.
- Definition Classes
- GenTOps
- def frequencyUnsafe[A](xs: List[(Int, GenT[A])]): GenT[A]
Uses a weighted distribution to randomly select one of the generators in the list.
Uses a weighted distribution to randomly select one of the generators in the list.
This generator shrinks towards the first generator in the list.
WARNING: This may throw an exception if the list is empty, please use one of the other
frequency
variants if possible.- Definition Classes
- GenTOps
- def fromSome[A](gen: Gen[Option[A]])(implicit F: Monad[Gen], G: MonadGen[Gen]): Gen[A]
Runs a
Option
generator until it produces aSome
.Runs a
Option
generator until it produces aSome
.This is implemented using
filter
and has the same caveats.- Definition Classes
- MonadGenOps
- def generate[A](f: (Size, Seed) => (Seed, A))(implicit G: MonadGen[Gen]): Gen[A]
Construct a generator that depends on the size parameter.
Construct a generator that depends on the size parameter.
- Definition Classes
- MonadGenOps
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hexit: GenT[Char]
Generates an ASCII hexit: '0' to '9', 'a' to 'f', 'A' to 'F'
Generates an ASCII hexit: '0' to '9', 'a' to 'f', 'A' to 'F'
- Definition Classes
- CharacterOps
- def int(range: Range[Int]): GenT[Int]
*******************************************************************
*******************************************************************
- Definition Classes
- GenTOps
- def integral[A](range: Range[A], fromLong: (Long) => A)(implicit arg0: Integral[A], F: MonadGen[Gen]): Gen[A]
Generates a random integral number in the given
[inclusive,inclusive]
range.Generates a random integral number in the given
[inclusive,inclusive]
range.When the generator tries to shrink, it will shrink towards the Range.origin of the specified Range.
For example, the following generator will produce a number between
1970
and2100
, but will shrink towards2000
:Gen.integral(Range.constantFrom(2000, 1970, 2100))
Some sample outputs from this generator might look like:
=== Outcome === 1973 === Shrinks === 2000 1987 1980 1976 1974 === Outcome === 2061 === Shrinks === 2000 2031 2046 2054 2058 2060
- Definition Classes
- MonadGenOps
- def integral_[A](range: Range[A], fromLong: (Long) => A)(implicit G: MonadGen[Gen], I: Integral[A]): Gen[A]
Generates a random integral number in the
[inclusive,inclusive]
range.Generates a random integral number in the
[inclusive,inclusive]
range.This generator does not shrink.
- Definition Classes
- MonadGenOps
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def latin1: GenT[Char]
Generates an Latin-1 character
Generates an Latin-1 character
- Definition Classes
- CharacterOps
- def list[A](gen: Gen[A], range: Range[Int])(implicit F: Monad[Gen], G: MonadGen[Gen]): Gen[List[A]]
Generates a list using a 'Range' to determine the length.
Generates a list using a 'Range' to determine the length.
- Definition Classes
- MonadGenOps
- def long(range: Range[Long]): GenT[Long]
- Definition Classes
- GenTOps
- def lower: GenT[Char]
Generates an ASCII lowercase letter: 'a' to 'z'
Generates an ASCII lowercase letter: 'a' to 'z'
- Definition Classes
- CharacterOps
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def octit: GenT[Char]
Generates an ASCII octit: '0' to '7'
Generates an ASCII octit: '0' to '7'
- Definition Classes
- CharacterOps
- def short(range: Range[Short]): GenT[Short]
- Definition Classes
- GenTOps
- def sized[A](f: (Size) => Gen[A])(implicit F: Monad[Gen], G: MonadGen[Gen]): Gen[A]
Construct a generator that depends on the size parameter.
Construct a generator that depends on the size parameter.
- Definition Classes
- MonadGenOps
- def string(gen: GenT[Char], range: Range[Int]): GenT[String]
Generates a string using 'Range' to determine the length.
Generates a string using 'Range' to determine the length.
- Definition Classes
- StringOps
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unicode: GenT[Char]
Generates a Unicode character, excluding noncharacters and invalid standalone surrogates:
Generates a Unicode character, excluding noncharacters and invalid standalone surrogates:
- Definition Classes
- CharacterOps
- def unicodeAll: GenT[Char]
Generates a Unicode character, including noncharacters and invalid standalone surrogates
Generates a Unicode character, including noncharacters and invalid standalone surrogates
- Definition Classes
- CharacterOps
- def upper: GenT[Char]
Generates an ASCII uppercase letter: 'A' to 'Z'
Generates an ASCII uppercase letter: 'A' to 'Z'
- Definition Classes
- CharacterOps
- 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])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)