diff options
Diffstat (limited to 'tests/pending')
-rw-r--r-- | tests/pending/run/is-valid-num.scala | 317 | ||||
-rw-r--r-- | tests/pending/run/t920.check | 1 | ||||
-rw-r--r-- | tests/pending/run/t920.scala | 20 | ||||
-rw-r--r-- | tests/pending/run/tuple-zipped.scala | 41 | ||||
-rw-r--r-- | tests/pending/run/vector1.check | 6 | ||||
-rw-r--r-- | tests/pending/run/vector1.scala | 199 |
6 files changed, 0 insertions, 584 deletions
diff --git a/tests/pending/run/is-valid-num.scala b/tests/pending/run/is-valid-num.scala deleted file mode 100644 index 5a4a0503d..000000000 --- a/tests/pending/run/is-valid-num.scala +++ /dev/null @@ -1,317 +0,0 @@ -/* - * filter: inliner warnings; re-run with -Yinline-warnings for details - */ -object Test { - def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - def y = BigDecimal("" + (Short.MaxValue + 1) + ".0") - def y1 = BigDecimal("0.1") - def y2 = BigDecimal("0.5") - - def l1 = Int.MaxValue.toLong + 1 - def l2 = Int.MinValue.toLong - 1 - - def main(args: Array[String]): Unit = { -// assert(x.isWhole, x) - assert(!x.isValidDouble, x) - assert(!x.isValidFloat, x) - assert(!x.isValidLong, x) - assert(!x.isValidInt, x) - assert(!x.isValidChar, x) - assert(!x.isValidShort, x) - assert(!x.isValidByte, x) - assert(y.isWhole, y) - assert(!y.isValidShort, y) - assert(y.isValidChar, y) - assert(y.isValidInt, y) - assert(y.isDecimalFloat, y) - assert(y.isDecimalDouble, y) - assert(y.isValidLong, y) - assert(!y.isValidByte, y) - assert(!y1.isWhole) - assert(!y1.isValidLong, y1) - assert(y1.isDecimalFloat, y1) - assert(y1.isDecimalDouble, y1) - assert(!y1.isExactFloat, y1) - assert(!y1.isExactDouble, y1) - assert(!y1.isValidInt, y1) - assert(!y1.isValidChar, y1) - assert(!y1.isValidShort, y1) - assert(!y1.isValidByte, y1) - assert(!y2.isValidLong, y2) - assert(y2.isExactFloat, y2) - assert(y2.isExactDouble, y2) - - assert(!l1.isValidInt && (l1 - 1).isValidInt, l1) - assert(!l2.isValidInt && (l2 + 1).isValidInt, l2) - - testBigInts() - testNonWholeDoubles() - testNaNs() - } - - def testBigInts(): Unit = { - def biExp2(e: Int) = BigInt(1) << e - def checkBigInt2(bi: BigInt): Unit = { checkBigInt(-bi); checkBigInt(bi) } - - val pf = 24 - val pd = 53 - - checkBigInt(BigInt(0)) - checkBigInt2(biExp2(0)) - - checkBigInt2(biExp2(7) - 1) - checkBigInt2(biExp2(7)) - checkBigInt2(biExp2(7) + 1) - - checkBigInt2(biExp2(8) - 1) - checkBigInt2(biExp2(8)) - checkBigInt2(biExp2(8) + 1) - - checkBigInt2(biExp2(15) - 1) - checkBigInt2(biExp2(15)) - checkBigInt2(biExp2(15) + 1) - - checkBigInt2(biExp2(16) - 1) - checkBigInt2(biExp2(16)) - checkBigInt2(biExp2(16) + 1) - - checkBigInt2(biExp2(pf) - 1) - checkBigInt2(biExp2(pf)) - checkBigInt2(biExp2(pf) + 1) - checkBigInt2(biExp2(pf) + 2) - checkBigInt2(biExp2(pf) - 2) - checkBigInt2(biExp2(pf + 1) - 1) - checkBigInt2(biExp2(pf + 1)) - checkBigInt2(biExp2(pf + 1) + 1) - checkBigInt2(biExp2(pf + 1) + 2) - checkBigInt2(biExp2(pf + 1) + 3) - checkBigInt2(biExp2(pf + 1) + 4) - - checkBigInt2(biExp2(31) - 1) - checkBigInt2(biExp2(31)) - checkBigInt2(biExp2(31) + 1) - - checkBigInt2(biExp2(32) - 1) - checkBigInt2(biExp2(32)) - checkBigInt2(biExp2(32) + 1) - checkBigInt2(biExp2(32) + biExp2(64 - pf)) - checkBigInt2(biExp2(32) + biExp2(64 - pf + 1)) - - checkBigInt2(biExp2(pd) - 1) - checkBigInt2(biExp2(pd)) - checkBigInt2(biExp2(pd) + 1) - checkBigInt2(biExp2(pd) + 2) - checkBigInt2(biExp2(pd + 1) - 2) - checkBigInt2(biExp2(pd + 1) - 1) - checkBigInt2(biExp2(pd + 1)) - checkBigInt2(biExp2(pd + 1) + 1) - checkBigInt2(biExp2(pd + 1) + 2) - checkBigInt2(biExp2(pd + 1) + 3) - checkBigInt2(biExp2(pd + 1) + 4) - - checkBigInt2(biExp2(63) - 1) - checkBigInt2(biExp2(63)) - checkBigInt2(biExp2(63) + 1) - checkBigInt2(biExp2(63) + biExp2(63 - pd)) - checkBigInt2(biExp2(63) + biExp2(63 - pd + 1)) - checkBigInt2(biExp2(63) + biExp2(63 - pf)) - checkBigInt2(biExp2(63) + biExp2(63 - pf + 1)) - - checkBigInt2(biExp2(64) - 1) - checkBigInt2(biExp2(64)) - checkBigInt2(biExp2(64) + 1) - checkBigInt2(biExp2(64) + biExp2(64 - pd)) - checkBigInt2(biExp2(64) + biExp2(64 - pd + 1)) - checkBigInt2(biExp2(64) + biExp2(64 - pf)) - checkBigInt2(biExp2(64) + biExp2(64 - pf + 1)) - - checkBigInt2(biExp2(127)) - checkBigInt2(biExp2(128) - biExp2(128 - pf)) - checkBigInt2(biExp2(128) - biExp2(128 - pf - 1)) - checkBigInt2(biExp2(128)) - - checkBigInt2(biExp2(1023)) - checkBigInt2(biExp2(1024) - biExp2(1024 - pd)) - checkBigInt2(biExp2(1024) - biExp2(1024 - pd - 1)) - checkBigInt2(biExp2(1024)) - } - - def testNonWholeDoubles(): Unit = { - checkNonWholeDouble(0.5) - checkNonWholeDouble(-math.E) - checkNonWholeDouble((1L << 51).toDouble + 0.5) - checkNonWholeDouble((1L << 23).toDouble + 0.5) - checkNonWholeDouble(Double.PositiveInfinity) - checkNonWholeDouble(Double.NegativeInfinity) - } - - def testNaNs(): Unit = { - assert(!Double.NaN.isWhole, Double.NaN) -// assert(!Double.NaN.isValidDouble, Double.NaN) -// assert(!Double.NaN.isValidFloat, Double.NaN) -// assert(!Double.NaN.isValidLong, Double.NaN) - assert(!Double.NaN.isValidInt, Double.NaN) - assert(!Double.NaN.isValidChar, Double.NaN) - assert(!Double.NaN.isValidShort, Double.NaN) - assert(!Double.NaN.isValidByte, Double.NaN) - - assert(!Float.NaN.isWhole, Float.NaN) -// assert(!Float.NaN.isValidDouble, Float.NaN) -// assert(!Float.NaN.isValidFloat, Float.NaN) -// assert(!Float.NaN.isValidLong, Float.NaN) - assert(!Float.NaN.isValidInt, Float.NaN) - assert(!Float.NaN.isValidChar, Float.NaN) - assert(!Float.NaN.isValidShort, Float.NaN) - assert(!Float.NaN.isValidByte, Float.NaN) - } - - def checkNonWholeDouble(d: Double): Unit = { - val f = d.toFloat - val isFloat = f == d - - if (!d.isInfinity) { - val bd = BigDecimal(new java.math.BigDecimal(d)) -// assert(!bd.isWhole, bd) - assert(bd.isExactDouble, bd) - assert(bd.isExactFloat == isFloat, bd) - assert(!bd.isValidLong, bd) - assert(!bd.isValidInt, bd) - assert(!bd.isValidChar, bd) - assert(!bd.isValidShort, bd) - assert(!bd.isValidByte, bd) - } - - assert(!d.isWhole, d) -// assert(d.isValidDouble, d) -// assert(d.isValidFloat == isFloat, d) -// assert(!d.isValidLong, d) - assert(!d.isValidInt, d) - assert(!d.isValidChar, d) - assert(!d.isValidShort, d) - assert(!d.isValidByte, d) - - if (isFloat) { - assert(!f.isWhole, f) -// assert(f.isValidDouble, f) -// assert(f.isValidFloat == isFloat, f) -// assert(!f.isValidLong, f) - assert(!f.isValidInt, f) - assert(!f.isValidChar, f) - assert(!f.isValidShort, f) - assert(!f.isValidByte, f) - } - } - - def checkBigInt(bi: BigInt): Unit = { - val bd = BigDecimal(bi, java.math.MathContext.UNLIMITED) - val isByte = bi >= Byte.MinValue && bi <= Byte.MaxValue - val isShort = bi >= Short.MinValue && bi <= Short.MaxValue - val isChar = bi >= Char.MinValue && bi <= Char.MaxValue - val isInt = bi >= Int.MinValue && bi <= Int.MaxValue - val isLong = bi >= Long.MinValue && bi <= Long.MaxValue - val isFloat = !bi.toFloat.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toFloat))) == 0 - val isDouble = !bi.toDouble.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toDouble))) == 0 - - assert(bd.isWhole, bd) - assert(bd.isBinaryDouble == isDouble, bd) - assert(bd.isBinaryFloat == isFloat, bd) - assert(bd.isValidLong == isLong, bd) - assert(bd.isValidInt == isInt, bd) - assert(bd.isValidChar == isChar, bd) - assert(bd.isValidShort == isShort, bd) - assert(bd.isValidByte == isByte, bd) - -// assert(bi.isWhole, bi) - assert(bi.isValidDouble == isDouble, bi) - assert(bi.isValidFloat == isFloat, bi) - assert(bi.isValidLong == isLong, bi) - assert(bi.isValidInt == isInt, bi) - assert(bi.isValidChar == isChar, bi) - assert(bi.isValidShort == isShort, bi) - assert(bi.isValidByte == isByte, bi) - - if (isDouble) { - val d = bi.toDouble - assert(d.isWhole, d) -// assert(d.isValidDouble == isDouble, d) -// assert(d.isValidFloat == isFloat, d) -// assert(d.isValidLong == isLong, d) - assert(d.isValidInt == isInt, d) - assert(d.isValidChar == isChar, d) - assert(d.isValidShort == isShort, d) - assert(d.isValidByte == isByte, d) - } - - if (isFloat) { - val f = bi.toFloat - assert(f.isWhole, f) -// assert(f.isValidDouble == isDouble, f) -// assert(f.isValidFloat == isFloat, f) -// assert(f.isValidLong == isLong, f) - assert(f.isValidInt == isInt, f) - assert(f.isValidChar == isChar, f) - assert(f.isValidShort == isShort, f) - assert(f.isValidByte == isByte, f) - } - - if (isLong) { - val l = bi.toLong - assert(l.isWhole, l) -// assert(l.isValidDouble == isDouble, l) -// assert(l.isValidFloat == isFloat, l) -// assert(l.isValidLong == isLong, l) - assert(l.isValidInt == isInt, l) - assert(l.isValidChar == isChar, l) - assert(l.isValidShort == isShort, l) - assert(l.isValidByte == isByte, l) - } - - if (isInt) { - val i = bi.toInt - assert(i.isWhole, i) -// assert(i.isValidDouble == isDouble, i) -// assert(i.isValidFloat == isFloat, i) -// assert(i.isValidLong == isLong, i) - assert(i.isValidInt == isInt, i) - assert(i.isValidChar == isChar, i) - assert(i.isValidShort == isShort, i) - assert(i.isValidByte == isByte, i) - } - - if (isChar) { - val c = bi.toChar - assert(c.isWhole, c) -// assert(c.isValidDouble == isDouble, c) -// assert(c.isValidFloat == isFloat, c) -// assert(c.isValidLong == isLong, c) - assert(c.isValidInt == isInt, c) - assert(c.isValidChar == isChar, c) - assert(c.isValidShort == isShort, c) - assert(c.isValidByte == isByte, c) - } - - if (isShort) { - val s = bi.toShort - assert(s.isWhole, s) -// assert(s.isValidDouble == isDouble, s) -// assert(s.isValidFloat == isFloat, s) -// assert(s.isValidLong == isLong, s) - assert(s.isValidInt == isInt, s) - assert(s.isValidChar == isChar, s) - assert(s.isValidShort == isShort, s) - assert(s.isValidByte == isByte, s) - } - - if (isByte) { - val b = bi.toByte - assert(b.isWhole, b) -// assert(b.isValidDouble == isDouble, b) -// assert(b.isValidFloat == isFloat, b) -// assert(b.isValidLong == isLong, b) - assert(b.isValidInt == isInt, b) - assert(b.isValidChar == isChar, b) - assert(b.isValidShort == isShort, b) - assert(b.isValidByte == isByte, b) - } - } -} diff --git a/tests/pending/run/t920.check b/tests/pending/run/t920.check deleted file mode 100644 index 76018072e..000000000 --- a/tests/pending/run/t920.check +++ /dev/null @@ -1 +0,0 @@ -baz diff --git a/tests/pending/run/t920.scala b/tests/pending/run/t920.scala deleted file mode 100644 index 6a7f122d5..000000000 --- a/tests/pending/run/t920.scala +++ /dev/null @@ -1,20 +0,0 @@ -object Test { - trait A; - trait Foo0 { def foo : A; } - trait Baz extends Foo0; - trait B extends A { - def initialize = { - trait Foo extends Test.Foo0 { - def foo : B.this.type = B.this; - } - class baz extends Baz with Foo { - override def toString = "baz" - } - Console.println(new baz); - } - } - object b extends B; - def main(args : Array[String]) : Unit = { - b.initialize; - } -} diff --git a/tests/pending/run/tuple-zipped.scala b/tests/pending/run/tuple-zipped.scala deleted file mode 100644 index 37ac52977..000000000 --- a/tests/pending/run/tuple-zipped.scala +++ /dev/null @@ -1,41 +0,0 @@ - -import scala.language.postfixOps - -object Test { - val xs1 = List.range(1, 100) - val xs2 = xs1.view - val xs3 = xs1 take 10 - val ss1 = Stream from 1 - val ss2 = ss1.view - val ss3 = ss1 take 10 - val as1 = 1 to 100 toArray - val as2 = as1.view - val as3 = as1 take 10 - - def xss1 = List[Seq[Int]](xs1, xs2, xs3, ss1, ss2, ss3, as1, as2, as3) - def xss2 = List[Seq[Int]](xs1, xs2, xs3, ss3, as1, as2, as3) // no infinities - def xss3 = List[Seq[Int]](xs2, xs3, ss3, as1) // representative sampling - - def main(args: Array[String]): Unit = { - for (cc1 <- xss1 ; cc2 <- xss2) { - val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum - val sum2 = (cc1, cc2).zipped map (_ + _) sum - - assert(sum1 == sum2) - } - - for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) { - val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum - val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum - - assert(sum1 == sum2) - } - - assert((ss1, ss1).zipped exists ((x, y) => true)) - assert((ss1, ss1, ss1).zipped exists ((x, y, z) => true)) - - assert(!(ss1, ss2, 1 to 3).zipped.exists(_ + _ + _ > 100000)) - assert((1 to 3, ss1, ss2).zipped.forall(_ + _ + _ > 0)) - assert((ss1, 1 to 3, ss2).zipped.map(_ + _ + _).size == 3) - } -} diff --git a/tests/pending/run/vector1.check b/tests/pending/run/vector1.check deleted file mode 100644 index 10447a096..000000000 --- a/tests/pending/run/vector1.check +++ /dev/null @@ -1,6 +0,0 @@ -===== test1 ===== -===== test2 ===== -===== test3 ===== -===== test4 ===== -===== test5 ===== -done diff --git a/tests/pending/run/vector1.scala b/tests/pending/run/vector1.scala deleted file mode 100644 index d53618396..000000000 --- a/tests/pending/run/vector1.scala +++ /dev/null @@ -1,199 +0,0 @@ -// testing the impl from the scala library -//package test5 - -import scala.collection._ -import scala.collection.immutable._ - -import scala.collection.generic._ -import scala.collection.mutable.Builder - - -object Test { - - def vector(label: String, n: Int): Vector[String] = { - val a = new VectorBuilder[String] - for (i <- 0 until n) - a += (label + i) - - val res = a.result - assertVector(res, label, 0, n) - } - - def vectorForward(label: String, n: Int): Vector[String] = { - var a: Vector[String] = Vector.empty - for (i <- 0 until n) - a = a :+ (label + i) - - assertVector(a, label, 0, n) - } - - def vectorBackward(label: String, n: Int): Vector[String] = { - var a: Vector[String] = Vector.empty - for (i <- 0 until n) - a = (label + (n-1-i)) +: a - - assertVector(a, label, 0, n) - } - - def assertVector[V](a: Vector[V], label: String, start: Int, end: Int) = { - assertVectorIndexed(a, label, start, end) - assertVectorIterated(a, label, start, end) - } - - def assertVectorIndexed[V](a: Vector[V], label: String, start: Int, end: Int) = { - val res = a - assert(res.length == (end-start), res.length+"!="+(end-start)+" ("+res+")") - for (i <- start until end) { - assert(res(i) == (label + i), ""+res(i)+"!="+(label + i)) - } - res - } - - def assertVectorIterated[V](a: Vector[V], label: String, start: Int, end: Int) = { - val res = a - assert(res.length == (end-start), res.length+"!="+(end-start)+" ("+res+")") - var i = start - var it = res.iterator - while(it.hasNext) { - val x = it.next() - assert(x == (label + i), x.toString+"!="+(label + i)) - i += 1 - } - assert(i == end) - res - } - - - - def test1() = { - println("===== test1 =====") - - val N = 150000 - val a = vector("a", N) - val b = vectorForward("b", N) - val c = vectorBackward("b", N) - - () -// //println(a) - } - - def test2() = { - println("===== test2 =====") - - var a: Vector[String] = Vector.empty - - val rand = new java.util.Random - - val N = 150000 - var min = N/2//rand.nextInt(N) - var max = min - - val chunkLimit = 11 - - def nextChunkSize = 3 //rand.nextInt(chunkLimit) - - def seqBack() = for (i <- 0 until Math.min(nextChunkSize, N-max)) { a = a :+ ("a"+max); max += 1 } - def seqFront() = for (i <- 0 until Math.min(nextChunkSize, min)) { min -= 1; a = ("a"+min) +: a } - - try { - - while (min > 0 || max < N) { - seqFront() - seqBack() - } - } catch { - case ex: Throwable => - //println("----------------") - //a.debug - throw ex - } - - assertVector(a, "a", 0, N) - } - - - - def test3() = { - println("===== test3 =====") - - val N = 150000 - val a = vector("a", N) - - val pos = scala.util.Random.shuffle(scala.collection.mutable.WrappedArray.make[Int](Array.tabulate[Int](N)(i => i))) - - var b = a - - { - var i = 0 - while (i < N) { - b = b.updated(pos(i), "b"+(pos(i))) - i += 1 - } - - assertVector(b, "b", 0, N) - } - -// //println(a) - } - - def test4() = { - println("===== test4 =====") - - val N = 150000 - val a = vectorForward("a", N) - - { - var i = 0 - var it = a - while (i < N) { - assert(it.length == (N-i), it.length+" items at iteration "+i) - val x = it(0) - val y = it(N-i-1) - assert(x == "a"+i, x+"!=a"+i) - assert(y == "a"+(N-1), y+"!=a"+(N-1)) - it = it.drop(1) - i += 1 - } - assert(it.length == 0) - } - -// //println(a) - } - - def test5() = { - println("===== test5 =====") - - val N = 150000 - val a = vectorBackward("a", N) - - { - var i = 0 - var it = a - while (i < N) { - assert(it.length == (N-i), it.length+" items at iteration "+i) - val x = it(0) - val y = it(N-i-1) -// println("x " + x + "/" + i) -// println("y " + y) - assert(x == "a0", x+"!=a0") - assert(y == "a"+(N-i-1), y+"!=a"+(N-i-1)) - it = it.dropRight(1) - i += 1 - } - assert(it.length == 0) - } - } - - def main(args: Array[String]) = { - - test1() - test2() - test3() - test4() - test5() - - println("done") - } - -} - |