org.scalacheck

object Arbitrary

[source: org/scalacheck/Arbitrary.scala]

object Arbitrary
extends AnyRef
Defines implicit Arbitrary instances for common types.

ScalaCheck uses implicit Arbitrary instances when creating properties out of functions with the Prop.property method, and when the Arbitrary.arbitrary method is used. For example, the following code requires that there exists an implicit Arbitrary[MyClass] instance:

val myProp = Prop.forAll { myClass: MyClass =>
...
}
val myGen = Arbitrary.arbitrary[MyClass]

The required implicit definition could look like this:

implicit val arbMyClass: Arbitrary[MyClass] = Arbitrary(...)

The factory method Arbitrary(...) takes a generator of type Gen[T] and returns an instance of Arbitrary[T].

The Arbitrary module defines implicit Arbitrary instances for common types, for convenient use in your properties and generators.

Value Summary
implicit lazy val arbBool : Arbitrary[Boolean]
implicit lazy val arbByte : Arbitrary[Byte]
implicit lazy val arbChar : Arbitrary[Char]
implicit lazy val arbDate : Arbitrary[java.util.Date]
implicit lazy val arbDouble : Arbitrary[Double]
implicit lazy val arbFloat : Arbitrary[Float]
implicit lazy val arbGenParams : Arbitrary[Params]
implicit lazy val arbInt : Arbitrary[Int]
implicit lazy val arbLong : Arbitrary[Long]
implicit lazy val arbProp : Arbitrary[Prop]
implicit lazy val arbPropParams : Arbitrary[Params]
implicit lazy val arbShort : Arbitrary[Short]
implicit lazy val arbString : Arbitrary[java.lang.String]
implicit lazy val arbTestParams : Arbitrary[Params]
implicit lazy val arbThrowable : Arbitrary[java.lang.Throwable]
Method Summary
def apply [T](g : => Gen[T]) : Arbitrary[T]
Creates an Arbitrary instance
implicit def arbArray [T](implicit a : Arbitrary[T]) : Arbitrary[scala.Array[T]]
implicit def arbArrayList [T](implicit a : Arbitrary[T]) : Arbitrary[java.util.ArrayList[T]]
implicit def arbEither [T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.Either[T, U]]
implicit def arbFunction1 [T1, R](implicit a : Arbitrary[R]) : Arbitrary[(T1) => R]
Arbitrary instance of Function1
implicit def arbFunction2 [T1, T2, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2) => R]
Arbitrary instance of Function2
implicit def arbFunction3 [T1, T2, T3, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3) => R]
Arbitrary instance of Function3
implicit def arbFunction4 [T1, T2, T3, T4, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3, T4) => R]
Arbitrary instance of Function4
implicit def arbFunction5 [T1, T2, T3, T4, T5, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3, T4, T5) => R]
Arbitrary instance of Function5
implicit def arbGen [T](implicit a : Arbitrary[T]) : Arbitrary[Gen[T]]
Arbitrary instance of Gen
implicit def arbImmutableMap [T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.collection.immutable.Map[T, U]]
Arbitrary instance of immutable map
implicit def arbImmutableSet [T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.immutable.Set[T]]
implicit def arbList [T](implicit a : Arbitrary[T]) : Arbitrary[scala.List[T]]
implicit def arbMutableMap [T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.collection.mutable.Map[T, U]]
Arbitrary instance of mutable map
implicit def arbMutableSet [T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.mutable.Set[T]]
implicit def arbOption [T](implicit a : Arbitrary[T]) : Arbitrary[scala.Option[T]]
Arbitrary instance of option type
implicit def arbSet [T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.Set[T]]
implicit def arbStream [T](implicit a : Arbitrary[T]) : Arbitrary[scala.Stream[T]]
implicit def arbTuple2 [T1, T2](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2]) : Arbitrary[(T1, T2)]
Arbitrary instance of 2-tuple
implicit def arbTuple3 [T1, T2, T3](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3]) : Arbitrary[(T1, T2, T3)]
Arbitrary instance of 3-tuple
implicit def arbTuple4 [T1, T2, T3, T4](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4]) : Arbitrary[(T1, T2, T3, T4)]
Arbitrary instance of 4-tuple
implicit def arbTuple5 [T1, T2, T3, T4, T5](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5]) : Arbitrary[(T1, T2, T3, T4, T5)]
Arbitrary instance of 5-tuple
implicit def arbTuple6 [T1, T2, T3, T4, T5, T6](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6]) : Arbitrary[(T1, T2, T3, T4, T5, T6)]
Arbitrary instance of 6-tuple
implicit def arbTuple7 [T1, T2, T3, T4, T5, T6, T7](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7)]
Arbitrary instance of 7-tuple
implicit def arbTuple8 [T1, T2, T3, T4, T5, T6, T7, T8](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7], implicit a8 : Arbitrary[T8]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7, T8)]
Arbitrary instance of 8-tuple
implicit def arbTuple9 [T1, T2, T3, T4, T5, T6, T7, T8, T9](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7], implicit a8 : Arbitrary[T8], implicit a9 : Arbitrary[T9]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7, T8, T9)]
Arbitrary instance of 9-tuple
def arbitrary [T](implicit a : Arbitrary[T]) : Gen[T]
Returns an arbitrary generator for the type T.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
implicit lazy val arbBool : Arbitrary[Boolean]

implicit lazy val arbInt : Arbitrary[Int]

implicit lazy val arbLong : Arbitrary[Long]

implicit lazy val arbDate : Arbitrary[java.util.Date]

implicit lazy val arbThrowable : Arbitrary[java.lang.Throwable]

implicit lazy val arbDouble : Arbitrary[Double]

implicit lazy val arbFloat : Arbitrary[Float]

implicit lazy val arbChar : Arbitrary[Char]

implicit lazy val arbByte : Arbitrary[Byte]

implicit lazy val arbShort : Arbitrary[Short]

implicit lazy val arbString : Arbitrary[java.lang.String]

implicit lazy val arbProp : Arbitrary[Prop]

implicit lazy val arbTestParams : Arbitrary[Params]

implicit lazy val arbGenParams : Arbitrary[Params]

implicit lazy val arbPropParams : Arbitrary[Params]

Method Details
def apply[T](g : => Gen[T]) : Arbitrary[T]
Creates an Arbitrary instance

def arbitrary[T](implicit a : Arbitrary[T]) : Gen[T]
Returns an arbitrary generator for the type T.

implicit def arbGen[T](implicit a : Arbitrary[T]) : Arbitrary[Gen[T]]
Arbitrary instance of Gen

implicit def arbOption[T](implicit a : Arbitrary[T]) : Arbitrary[scala.Option[T]]
Arbitrary instance of option type

implicit def arbEither[T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.Either[T, U]]

implicit def arbImmutableMap[T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.collection.immutable.Map[T, U]]
Arbitrary instance of immutable map

implicit def arbMutableMap[T, U](implicit at : Arbitrary[T], implicit au : Arbitrary[U]) : Arbitrary[scala.collection.mutable.Map[T, U]]
Arbitrary instance of mutable map

implicit def arbList[T](implicit a : Arbitrary[T]) : Arbitrary[scala.List[T]]

implicit def arbStream[T](implicit a : Arbitrary[T]) : Arbitrary[scala.Stream[T]]

implicit def arbArray[T](implicit a : Arbitrary[T]) : Arbitrary[scala.Array[T]]

implicit def arbImmutableSet[T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.immutable.Set[T]]

implicit def arbMutableSet[T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.mutable.Set[T]]

implicit def arbSet[T](implicit a : Arbitrary[T]) : Arbitrary[scala.collection.Set[T]]

implicit def arbArrayList[T](implicit a : Arbitrary[T]) : Arbitrary[java.util.ArrayList[T]]

implicit def arbFunction1[T1, R](implicit a : Arbitrary[R]) : Arbitrary[(T1) => R]
Arbitrary instance of Function1

implicit def arbFunction2[T1, T2, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2) => R]
Arbitrary instance of Function2

implicit def arbFunction3[T1, T2, T3, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3) => R]
Arbitrary instance of Function3

implicit def arbFunction4[T1, T2, T3, T4, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3, T4) => R]
Arbitrary instance of Function4

implicit def arbFunction5[T1, T2, T3, T4, T5, R](implicit a : Arbitrary[R]) : Arbitrary[(T1, T2, T3, T4, T5) => R]
Arbitrary instance of Function5

implicit def arbTuple2[T1, T2](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2]) : Arbitrary[(T1, T2)]
Arbitrary instance of 2-tuple

implicit def arbTuple3[T1, T2, T3](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3]) : Arbitrary[(T1, T2, T3)]
Arbitrary instance of 3-tuple

implicit def arbTuple4[T1, T2, T3, T4](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4]) : Arbitrary[(T1, T2, T3, T4)]
Arbitrary instance of 4-tuple

implicit def arbTuple5[T1, T2, T3, T4, T5](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5]) : Arbitrary[(T1, T2, T3, T4, T5)]
Arbitrary instance of 5-tuple

implicit def arbTuple6[T1, T2, T3, T4, T5, T6](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6]) : Arbitrary[(T1, T2, T3, T4, T5, T6)]
Arbitrary instance of 6-tuple

implicit def arbTuple7[T1, T2, T3, T4, T5, T6, T7](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7)]
Arbitrary instance of 7-tuple

implicit def arbTuple8[T1, T2, T3, T4, T5, T6, T7, T8](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7], implicit a8 : Arbitrary[T8]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7, T8)]
Arbitrary instance of 8-tuple

implicit def arbTuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](implicit a1 : Arbitrary[T1], implicit a2 : Arbitrary[T2], implicit a3 : Arbitrary[T3], implicit a4 : Arbitrary[T4], implicit a5 : Arbitrary[T5], implicit a6 : Arbitrary[T6], implicit a7 : Arbitrary[T7], implicit a8 : Arbitrary[T8], implicit a9 : Arbitrary[T9]) : Arbitrary[(T1, T2, T3, T4, T5, T6, T7, T8, T9)]
Arbitrary instance of 9-tuple