summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-03-01 05:59:11 +0000
committerPaul Phillips <paulp@improving.org>2010-03-01 05:59:11 +0000
commit07f1f6dd14f8342f40f139781317755ceb661b96 (patch)
treee7f393e2e678fa946b80a9858bc6b0f6e51fb1f9 /test/files
parentb94c6e0da6d33bc69f1419634128e2f401109b61 (diff)
downloadscala-07f1f6dd14f8342f40f139781317755ceb661b96.tar.gz
scala-07f1f6dd14f8342f40f139781317755ceb661b96.tar.bz2
scala-07f1f6dd14f8342f40f139781317755ceb661b96.zip
Enabled scalacheck tests.
what must be legacy scalatest.* properties to partest.*, boldly assuming that the fact that partest is pretty much unusable outside of scalac means there are no users outside of scalac who might be disrupted by eliminating old property names. Review by community.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/jvm/inner.scala4
-rw-r--r--test/files/run/programmatic-main.scala2
-rw-r--r--test/files/scalacheck/eqeq.scala32
3 files changed, 29 insertions, 9 deletions
diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala
index 51e3909ef3..d6b055e998 100644
--- a/test/files/jvm/inner.scala
+++ b/test/files/jvm/inner.scala
@@ -53,8 +53,8 @@ class A {
}
object Scalatest {
- private val outputdir = System.getProperty("scalatest.output", "inner-jvm.obj")
- private val scalalib = System.getProperty("scalatest.lib", "")
+ private val outputdir = System.getProperty("partest.output", "inner-jvm.obj")
+ private val scalalib = System.getProperty("partest.lib", "")
private val classpath = outputdir + File.pathSeparator + scalalib
private val javabin = {
val jhome = new File(System.getProperty("java.home"))
diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala
index 0e91d219a7..c97e4a8f3f 100644
--- a/test/files/run/programmatic-main.scala
+++ b/test/files/run/programmatic-main.scala
@@ -3,7 +3,7 @@ import io.Path
object Test
{
- val cwd = Option(System.getProperty("scalatest.cwd")) getOrElse "."
+ val cwd = Option(System.getProperty("partest.cwd")) getOrElse "."
val basedir = (Path(cwd).parent / "lib").path
val baseargs = Array("-bootclasspath", basedir + "/scala-library.jar", "-cp", basedir + "/scala-compiler.jar")
diff --git a/test/files/scalacheck/eqeq.scala b/test/files/scalacheck/eqeq.scala
index 163f17d94c..60fe63c207 100644
--- a/test/files/scalacheck/eqeq.scala
+++ b/test/files/scalacheck/eqeq.scala
@@ -3,15 +3,35 @@ import Prop._
import Gen._
object Test extends Properties("==") {
- property("reflexive") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) }
- // property("hashCode") = forAll { (x
+ def equalObjectsEqualHashcodes(x: Any, y: Any) = (x != y) || (x == y && x.## == y.##)
+ // ticket #2087
property("short/char") = forAll { (x: Short) => {
val ch: Char = x.toChar
- (x == ch) == (ch == x) ||
- // that's the whole test once it works, but since it doesn't yet:
- x < 0
+ (x == ch) == (ch == x)
}
}
-}
+ property("symmetry") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) }
+ property("transitivity") = forAll { (x: AnyVal, y: AnyVal, z: AnyVal) => x != y || y != z || x == z }
+
+ property("##") = forAll {
+ (x: Short) => {
+ val anyvals = List(x.toByte, x.toChar, x, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x))
+ val shortAndLarger = anyvals drop 2
+
+ val result = (
+ ((anyvals, anyvals).zipped forall equalObjectsEqualHashcodes) &&
+ ((shortAndLarger, shortAndLarger).zipped forall (_ == _)) &&
+ ((shortAndLarger, shortAndLarger).zipped forall ((x, y) => (x: Any) == (y: Any)))
+ )
+ result
+ }
+ }
+ property("## 2") = forAll {
+ (dv: Double) => {
+ val fv = dv.toFloat
+ (fv != dv) || (fv.## == dv.##)
+ }
+ }
+}