@@ -20,65 +20,65 @@ import util.Buildable
2020import util .SerializableCanBuildFroms ._
2121
2222/** Define an arbitrary generator for properties
23- *
24- * The [[Arbitrary ]] module defines implicit generator instances for common types.
25- *
26- * The implicit definitions of [[Arbitrary ]] provide type-directed [[Gen ]]s so they are available for properties,
27- * generators, or other definitions of [[Arbitrary ]].
28- *
29- * ScalaCheck expects an implicit [[Arbitrary ]] instance is in scope for [[Prop ]]s that are defined with functions,
30- * like [[Prop$.forAll[T1,P](g1* Prop.forAll]] and so on.
31- *
32- * For instance, the definition for `Arbitrary[Boolean]` is used by `Prop.forAll` to automatically provide a
33- * `Gen[Boolean]` when one of the parameters is a `Boolean`:
34- *
35- * {{{
36- * Prop.forAll { (b: Boolean) =>
37- * b || !b
38- * }
39- * }}}
40- *
41- * Thanks to `Arbitrary`, you don't need to provide an explicit `Gen` instance to `Prop.forAll`. For instance, this is
42- * unnecessary:
43- *
44- * {{{
45- * val genBool: Gen[Boolean] = Gen.oneOf(true,false)
46- * Prop.forAll(genBool) { (b: Boolean) =>
47- * b || !b
48- * }
49- * }}}
50- *
51- * Since an arbitrary `Gen` for `Boolean` is defined in `Arbitrary`, it can be summoned with `Arbitrary.arbitrary` in
52- * cases where you need to provide one explicitly:
53- *
54- * {{{
55- * val genBool: Gen[Boolean] = Arbitrary.arbitrary[Boolean]
56- * val genSmallInt: Gen[Int] = Gen.choose(0, 9)
57- * Prop.forAll(genBool, genSmallInt) { (b: Boolean, i: Int) =>
58- * i < 10 && b || !b
59- * }
60- * }}}
61- *
62- * For a user-defined `MyClass`, writing the following requires that there exists an implicit `Arbitrary[MyClass]`
63- * instance:
64- *
65- * {{{
66- * Prop.forAll { (myClass: MyClass) =>
67- * ...
68- * }
69- * }}}
70- *
71- * The implicit definition of `Arbitrary[MyClass]` would look like:
72- *
73- * {{{
74- * implicit val arbMyClass: Arbitrary[MyClass] = Arbitrary {
75- * ...
76- * }
77- * }}}
78- *
79- * The factory method `Arbitrary(...)` expects a generator of type `Gen[MyClass]` then it will return an instance of
80- * `Arbitrary[MyClass]`.
81- */
23+ *
24+ * The [[Arbitrary ]] module defines implicit generator instances for common types.
25+ *
26+ * The implicit definitions of [[Arbitrary ]] provide type-directed [[Gen ]]s so they are available for properties,
27+ * generators, or other definitions of [[Arbitrary ]].
28+ *
29+ * ScalaCheck expects an implicit [[Arbitrary ]] instance is in scope for [[Prop ]]s that are defined with functions,
30+ * like [[Prop$.forAll[T1,P](g1* Prop.forAll]] and so on.
31+ *
32+ * For instance, the definition for `Arbitrary[Boolean]` is used by `Prop.forAll` to automatically provide a
33+ * `Gen[Boolean]` when one of the parameters is a `Boolean`:
34+ *
35+ * {{{
36+ * Prop.forAll { (b: Boolean) =>
37+ * b || !b
38+ * }
39+ * }}}
40+ *
41+ * Thanks to `Arbitrary`, you don't need to provide an explicit `Gen` instance to `Prop.forAll`. For instance, this is
42+ * unnecessary:
43+ *
44+ * {{{
45+ * val genBool: Gen[Boolean] = Gen.oneOf(true,false)
46+ * Prop.forAll(genBool) { (b: Boolean) =>
47+ * b || !b
48+ * }
49+ * }}}
50+ *
51+ * Since an arbitrary `Gen` for `Boolean` is defined in `Arbitrary`, it can be summoned with `Arbitrary.arbitrary` in
52+ * cases where you need to provide one explicitly:
53+ *
54+ * {{{
55+ * val genBool: Gen[Boolean] = Arbitrary.arbitrary[Boolean]
56+ * val genSmallInt: Gen[Int] = Gen.choose(0, 9)
57+ * Prop.forAll(genBool, genSmallInt) { (b: Boolean, i: Int) =>
58+ * i < 10 && b || !b
59+ * }
60+ * }}}
61+ *
62+ * For a user-defined `MyClass`, writing the following requires that there exists an implicit `Arbitrary[MyClass]`
63+ * instance:
64+ *
65+ * {{{
66+ * Prop.forAll { (myClass: MyClass) =>
67+ * ...
68+ * }
69+ * }}}
70+ *
71+ * The implicit definition of `Arbitrary[MyClass]` would look like:
72+ *
73+ * {{{
74+ * implicit val arbMyClass: Arbitrary[MyClass] = Arbitrary {
75+ * ...
76+ * }
77+ * }}}
78+ *
79+ * The factory method `Arbitrary(...)` expects a generator of type `Gen[MyClass]` then it will return an instance of
80+ * `Arbitrary[MyClass]`.
81+ */
8282sealed abstract class Arbitrary [T ] extends Serializable {
8383 def arbitrary : Gen [T ]
8484}
@@ -103,7 +103,7 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
103103 def arbitrary [T ](implicit a : Arbitrary [T ]): Gen [T ] = a.arbitrary
104104
105105 /** ** Arbitrary instances for each AnyVal ***
106- */
106+ */
107107
108108 /** Arbitrary AnyVal */
109109 implicit lazy val arbAnyVal : Arbitrary [AnyVal ] = Arbitrary (oneOf(
@@ -174,7 +174,7 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
174174 Arbitrary (Gen .const(()))
175175
176176 /** Arbitrary instances of other common types
177- */
177+ */
178178
179179 /** Arbitrary instance of String */
180180 implicit lazy val arbString : Arbitrary [String ] =
@@ -307,10 +307,10 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
307307 Arbitrary (Gen .finiteDuration)
308308
309309 /** Arbitrary instance of Duration.
310- *
311- * In addition to `FiniteDuration` values, this can generate `Duration.Inf`, `Duration.MinusInf`, and
312- * `Duration.Undefined`.
313- */
310+ *
311+ * In addition to `FiniteDuration` values, this can generate `Duration.Inf`, `Duration.MinusInf`, and
312+ * `Duration.Undefined`.
313+ */
314314 implicit lazy val arbDuration : Arbitrary [Duration ] =
315315 Arbitrary (Gen .duration)
316316
@@ -385,17 +385,17 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
385385 Arbitrary (Gen .oneOf(arbitrary[T ].map(Success (_)), arbitrary[Throwable ].map(Failure (_))))
386386
387387 /** Arbitrary instance of any [[org.scalacheck.util.Buildable ]] container (such as lists, arrays, streams / lazy
388- * lists, etc). The maximum size of the container depends on the size generation parameter.
389- */
388+ * lists, etc). The maximum size of the container depends on the size generation parameter.
389+ */
390390 implicit def arbContainer [C [_], T ](implicit
391391 a : Arbitrary [T ],
392392 b : Buildable [T , C [T ]],
393393 t : C [T ] => Traversable [T ]
394394 ): Arbitrary [C [T ]] = Arbitrary (buildableOf[C [T ], T ](arbitrary[T ]))
395395
396396 /** Arbitrary instance of any [[org.scalacheck.util.Buildable ]] container (such as maps). The maximum size of the
397- * container depends on the size generation parameter.
398- */
397+ * container depends on the size generation parameter.
398+ */
399399 implicit def arbContainer2 [C [_, _], T , U ](implicit
400400 a : Arbitrary [(T , U )],
401401 b : Buildable [(T , U ), C [T , U ]],
0 commit comments