summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominik Gruntz <dominik.gruntz@fhnw.ch>2012-05-09 15:01:25 +0200
committerDominik Gruntz <dominik.gruntz@fhnw.ch>2012-05-09 15:01:25 +0200
commitb5919100e785df58bde35bb24abe9d60b4da08a2 (patch)
treebfc40fc70e04624bf65d60a540b628cc934bba07 /test
parent58bb2d1bd2000ac3aa2c64b6c5dc56c91e911860 (diff)
downloadscala-b5919100e785df58bde35bb24abe9d60b4da08a2.tar.gz
scala-b5919100e785df58bde35bb24abe9d60b4da08a2.tar.bz2
scala-b5919100e785df58bde35bb24abe9d60b4da08a2.zip
removes redundant hash implementation from BoxesRunTime.java
Diffstat (limited to 'test')
-rw-r--r--test/files/run/hashCodeScalaRunTime.scala (renamed from test/files/run/hashCodeBoxesRunTime.scala)10
-rw-r--r--test/files/run/hashhash.scala8
2 files changed, 13 insertions, 5 deletions
diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeScalaRunTime.scala
index 081a73376e..e352af95f1 100644
--- a/test/files/run/hashCodeBoxesRunTime.scala
+++ b/test/files/run/hashCodeScalaRunTime.scala
@@ -1,23 +1,23 @@
-// This only tests direct access to the methods in BoxesRunTime,
+// This only tests direct access to the methods in ScalaRunTime,
// not the whole scheme.
object Test
{
import java.{ lang => jl }
- import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject }
+ 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 hashFromNumber)
+ 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 hashFromNumber
+ val hashes = mkNumbers(n) map hash
allSame(hashes)
if (n >= 0) {
- val charCode = hashFromObject(n.toChar: Character)
+ val charCode = hash(n.toChar: Character)
assert(charCode == hashes.head)
}
}
diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala
index dc31df8cfa..f9fc067398 100644
--- a/test/files/run/hashhash.scala
+++ b/test/files/run/hashhash.scala
@@ -9,7 +9,15 @@ 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)))
}
}