org.scalacheck

object Gen

[source: org/scalacheck/Gen.scala]

object Gen
extends Properties
Contains combinators for building generators.
Value Summary
val defaultParams : Params
val name : java.lang.String
Method Summary
def alphaChar : Gen[Char]
def alphaLowerChar : Gen[Char]
def alphaNumChar : Gen[Char]
def alphaUpperChar : Gen[Char]
def choose (low : Double, high : Double) : Gen[Double]
A generator that generates a random double in the given (inclusive) range.
def choose (low : Int, high : Int) : Gen[Int]
A generator that generates a random integer in the given (inclusive) range.
def containerOf [C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.
def containerOf1 [C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a non-empty container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.
def containerOfN [C, T](n : Int, g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the generated container is given by n.
def elements [T](xs : T*) : Gen[T]
A generator that returns a random element from a list
def elementsFreq [T](vs : (Int, T)*) : Gen[T]
Chooses one of the given values, with a weighted random distribution.
def fail [T] : Gen[T]
A generator that never generates a value
def frequency [T](gs : (Int, Gen[T])*) : Gen[T]
Chooses one of the given generators with a weighted random distribution
def identifier : Gen[java.lang.String]
def listOf [T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf[List,T](g).
def listOf1 [T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a non-empty list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf1[List,T](g).
def lzy [T](g : => Gen[T]) : Gen[T]
Wraps a generator lazily. Useful when defining recursive generators.
def numChar : Gen[Char]
def oneOf [T](gs : Gen[T]*) : Gen[T]
Picks a random generator from a list
def parameterized [T](f : (Params) => Gen[T]) : Gen[T]
Creates a generator that can access its generation parameters
def pick [T](n : Int, l : scala.Collection[T]) : Gen[scala.Seq[T]]
Picks a given number of elements from a list
def resize [T](s : Int, g : Gen[T]) : Gen[T]
Creates a resized version of a generator
def sequence [C, T](gs : scala.Iterable[Gen[T]])(implicit b : Buildable[C]) : Gen[C[T]]
Sequences generators. If any of the given generators fails, the resulting generator will also fail.
def sized [T](f : (Int) => Gen[T]) : Gen[T]
Creates a generator that can access its generation size
def someOf [T](l : scala.Collection[T]) : Gen[scala.Seq[T]]
Picks some elements from a list
def value [T](f : () => T) : Gen[T]
A generator that always generates the given value
def value [T](x : T) : Gen[T]
A generator that always generates the given value
def vectorOf [T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).
Methods inherited from Properties
specify, specify, specify, specify, specify, specify, specify, checkProperties, checkProperties, checkProperties, checkProperties, testCases, allProperties
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
case class Params (val size : Int, val rand : RandomGenerator) extends scala.Product
Record that encapsulates all parameters required for data generation
Value Details
val name : java.lang.String
Overrides
Properties.name

val defaultParams : Params

Method Details
def sequence[C, T](gs : scala.Iterable[Gen[T]])(implicit b : Buildable[C]) : Gen[C[T]]
Sequences generators. If any of the given generators fails, the resulting generator will also fail.

def containerOfN[C, T](n : Int, g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the generated container is given by n.

def containerOf[C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.

def containerOf1[C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a non-empty container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.

def lzy[T](g : => Gen[T]) : Gen[T]
Wraps a generator lazily. Useful when defining recursive generators.

def value[T](x : T) : Gen[T]
A generator that always generates the given value

def value[T](f : () => T) : Gen[T]
A generator that always generates the given value

def fail[T] : Gen[T]
A generator that never generates a value

def choose(low : Int, high : Int) : Gen[Int]
A generator that generates a random integer in the given (inclusive) range.

def choose(low : Double, high : Double) : Gen[Double]
A generator that generates a random double in the given (inclusive) range.

def parameterized[T](f : (Params) => Gen[T]) : Gen[T]
Creates a generator that can access its generation parameters

def sized[T](f : (Int) => Gen[T]) : Gen[T]
Creates a generator that can access its generation size

def resize[T](s : Int, g : Gen[T]) : Gen[T]
Creates a resized version of a generator

def frequency[T](gs : (Int, Gen[T])*) : Gen[T]
Chooses one of the given generators with a weighted random distribution

def elementsFreq[T](vs : (Int, T)*) : Gen[T]
Chooses one of the given values, with a weighted random distribution.

def elements[T](xs : T*) : Gen[T]
A generator that returns a random element from a list

def oneOf[T](gs : Gen[T]*) : Gen[T]
Picks a random generator from a list

def listOf[T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf[List,T](g).

def listOf1[T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a non-empty list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf1[List,T](g).

def vectorOf[T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).

def someOf[T](l : scala.Collection[T]) : Gen[scala.Seq[T]]
Picks some elements from a list

def pick[T](n : Int, l : scala.Collection[T]) : Gen[scala.Seq[T]]
Picks a given number of elements from a list

def numChar : Gen[Char]

def alphaUpperChar : Gen[Char]

def alphaLowerChar : Gen[Char]

def alphaChar : Gen[Char]

def alphaNumChar : Gen[Char]

def identifier : Gen[java.lang.String]