@@ -51,8 +51,6 @@ import org.scalatest.prop.Checkers
5151 */
5252object PropertiesSection extends Checkers with Matchers with org.scalaexercises.definitions.Section {
5353
54- import PropertiesHelpers ._
55-
5654 /** ==Universally quantified properties==
5755 *
5856 * As mentioned before, `org.scalacheck.Prop.forAll` creates universally quantified properties.
@@ -177,33 +175,30 @@ object PropertiesSection extends Checkers with Matchers with org.scalaexercises.
177175 *
178176 * Often you want to specify several related properties, perhaps for all methods in a class.
179177 * ScalaCheck provides a simple way of doing this, through the `Properties` trait.
180- * Look at the following specifications that define some properties for zero:
181- *
182- * {{{
183- * import org.scalacheck._
184- *
185- * class ZeroSpecification(value: Int) extends Properties("Zero") {
186- *
187- * import org.scalacheck.Prop.{BooleanOperators, forAll}
188- *
189- * property("addition property") = forAll { n: Int => (n != 0) ==> (n + value == n) }
190- *
191- * property("additive inverse property") = forAll { n: Int => (n != 0) ==> (n + (-n) == value) }
192- *
193- * property("multiplication property") = forAll { n: Int => (n != 0) ==> (n * value == 0) }
194- *
195- * }
196- * }}}
178+ * Look at the following specifications that define some properties for zero.
197179 *
198180 * You can use the check method of the `Properties` class to check all specified properties,
199181 * just like for simple `Prop` instances. In fact, `Properties` is a subtype of `Prop`,
200182 * so you can use it just as if it was a single property.
201183 *
202184 * That single property holds if and only if all of the contained properties hold.
185+ *
203186 */
204- def groupingProperties (res0 : Int ) = {
187+ def groupingProperties (res0 : Int , res1 : Int , res2 : Int ) = {
188+ import org .scalacheck .Properties
205189
206- check( new ZeroSpecification (res0))
190+ class ZeroSpecification extends Properties ( " Zero " ) {
207191
208- }
192+ import org .scalacheck .Prop .{BooleanOperators , forAll }
193+
194+ property(" addition property" ) = forAll { n : Int => (n != 0 ) ==> (n + res0 == n) }
195+
196+ property(" additive inverse property" ) = forAll { n : Int => (n != 0 ) ==> (n + (- n) == res1) }
197+
198+ property(" multiplication property" ) = forAll { n : Int => (n != 0 ) ==> (n * res2 == 0 ) }
199+
200+ }
201+
202+ check(new ZeroSpecification )
203+ }
209204}
0 commit comments