From 1cd498f9091504b42030d4b81c6f659bc386115f Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 9 May 2012 15:52:44 -0700 Subject: Revert recent commits. This reverts commit 9b6f51d3ae6ddc6571d3101ea715e25a05aa8adb. This reverts commit b5919100e785df58bde35bb24abe9d60b4da08a2. --- test/files/run/hashCodeBoxesRunTime.scala | 28 ++++++++++++++++++++++++++++ test/files/run/hashCodeScalaRunTime.scala | 28 ---------------------------- test/files/run/hashhash.scala | 8 -------- 3 files changed, 28 insertions(+), 36 deletions(-) create mode 100644 test/files/run/hashCodeBoxesRunTime.scala delete mode 100644 test/files/run/hashCodeScalaRunTime.scala (limited to 'test/files/run') diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala new file mode 100644 index 0000000000..081a73376e --- /dev/null +++ b/test/files/run/hashCodeBoxesRunTime.scala @@ -0,0 +1,28 @@ +// This only tests direct access to the methods in BoxesRunTime, +// not the whole scheme. +object Test +{ + import java.{ lang => jl } + import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject } + + def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs) + + def mkNumbers(x: Int): List[Number] = + List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble) + + def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber) + + def main(args: Array[String]): Unit = { + List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => + val hashes = mkNumbers(n) map hashFromNumber + allSame(hashes) + if (n >= 0) { + val charCode = hashFromObject(n.toChar: Character) + assert(charCode == hashes.head) + } + } + + testLDF(Short.MaxValue.toLong) + testLDF(Short.MinValue.toLong) + } +} diff --git a/test/files/run/hashCodeScalaRunTime.scala b/test/files/run/hashCodeScalaRunTime.scala deleted file mode 100644 index e352af95f1..0000000000 --- a/test/files/run/hashCodeScalaRunTime.scala +++ /dev/null @@ -1,28 +0,0 @@ -// This only tests direct access to the methods in ScalaRunTime, -// not the whole scheme. -object Test -{ - import java.{ lang => jl } - import scala.runtime.ScalaRunTime.{ hash } - - def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs) - - def mkNumbers(x: Int): List[Number] = - List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble) - - def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hash) - - def main(args: Array[String]): Unit = { - List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => - val hashes = mkNumbers(n) map hash - allSame(hashes) - if (n >= 0) { - val charCode = hash(n.toChar: Character) - assert(charCode == hashes.head) - } - } - - testLDF(Short.MaxValue.toLong) - testLDF(Short.MinValue.toLong) - } -} diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala index f9fc067398..dc31df8cfa 100644 --- a/test/files/run/hashhash.scala +++ b/test/files/run/hashhash.scala @@ -9,15 +9,7 @@ object Test { val x = (BigInt(1) << 64).toDouble val y: Any = x - val f: Float = x.toFloat - val jn: java.lang.Number = x - val jf: java.lang.Float = x.toFloat - val jd: java.lang.Double = x assert(x.## == y.##, ((x, y))) - assert(x.## == f.##, ((x, f))) - assert(x.## == jn.##, ((x, jn))) - assert(x.## == jf.##, ((x, jf))) - assert(x.## == jd.##, ((x, jd))) } } -- cgit v1.2.3