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.property { 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 arbDouble : Arbitrary[Double]
implicit lazy val arbGenParams : Arbitrary[Params]
implicit lazy val arbInt : Arbitrary[Int]
implicit lazy val arbProp : Arbitrary[Prop]
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 arbGen [T](implicit a : Arbitrary[T]) : Arbitrary[Gen[T]]
Arbitrary instance of Gen
implicit def arbList [T](implicit a : Arbitrary[T]) : Arbitrary[scala.List[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 arbThrowable : Arbitrary[java.lang.Throwable]

implicit lazy val arbDouble : Arbitrary[Double]

implicit lazy val arbChar : Arbitrary[Char]

implicit lazy val arbByte : Arbitrary[Byte]

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]

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 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 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 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