summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-09-16 22:46:46 +0000
committerPaul Phillips <paulp@improving.org>2009-09-16 22:46:46 +0000
commitef05daf1001efb579ab04e43a0b6a7c4d8d9b92c (patch)
tree34d829e47132c1be78fa5c371ac8b37a371757d5 /test
parent5dbf500ff823098087046823917f1c3dd6c63b9a (diff)
downloadscala-ef05daf1001efb579ab04e43a0b6a7c4d8d9b92c.tar.gz
scala-ef05daf1001efb579ab04e43a0b6a7c4d8d9b92c.tar.bz2
scala-ef05daf1001efb579ab04e43a0b6a7c4d8d9b92c.zip
An enhanced scalacheck with new powers (includi...
An enhanced scalacheck with new powers (including arbUnit, for all your arbitrary Unit needs) and some tests for recent Array-related crashers, including test case for the now working #2299.
Diffstat (limited to 'test')
-rw-r--r--test/files/lib/ScalaCheck.jar.desired.sha12
-rw-r--r--test/files/scalacheck/array.scala37
2 files changed, 38 insertions, 1 deletions
diff --git a/test/files/lib/ScalaCheck.jar.desired.sha1 b/test/files/lib/ScalaCheck.jar.desired.sha1
index 55aa27f176..eaf6a10124 100644
--- a/test/files/lib/ScalaCheck.jar.desired.sha1
+++ b/test/files/lib/ScalaCheck.jar.desired.sha1
@@ -1 +1 @@
-08cea28f282d8360a6344a8cfb853522e18915bb ?ScalaCheck.jar
+11d0f9f9235146558bbfe94f3270aa5be3930079 ?ScalaCheck.jar
diff --git a/test/files/scalacheck/array.scala b/test/files/scalacheck/array.scala
new file mode 100644
index 0000000000..0b7dee5716
--- /dev/null
+++ b/test/files/scalacheck/array.scala
@@ -0,0 +1,37 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+import util._
+import Buildable._
+
+object Test extends Properties("Array") {
+ val myGens: Seq[Gen[Array[_]]] = List(
+ arbArray[Int],
+ arbArray[Array[Int]],
+ arbArray[List[String]],
+ arbArray[String],
+ arbArray[Boolean],
+ arbArray[AnyVal](arbAnyVal)
+ ) map (_.arbitrary)
+
+ property("eq/ne") =
+ forAll(oneOf(myGens: _*)) { c1 =>
+ forAll(oneOf(myGens: _*)) { c2 =>
+ (c1 eq c2) || (c1 ne c2)
+ }
+ }
+
+ def smallInt = choose(1, 10)
+ property("ofDim") = forAll(smallInt) { i1 =>
+ forAll(smallInt) { i2 =>
+ forAll(smallInt) { i3 =>
+ val arr = Array.ofDim[String](i1, i2, i3)
+ val flattened = arr flatMap (x => x) flatMap (x => x)
+
+ flattened.length == i1 * i2 * i3
+ }
+ }
+ }
+}
+