summaryrefslogtreecommitdiff
path: root/test/files/run/vector1.scala
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
commitb6778be91900b8161e705dc2598ef7af86842b0b (patch)
treed15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/files/run/vector1.scala
parentac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff)
downloadscala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz
scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2
scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip
Begone t1737...
Diffstat (limited to 'test/files/run/vector1.scala')
-rw-r--r--test/files/run/vector1.scala24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala
index e8785e2b16..b37cfe82e8 100644
--- a/test/files/run/vector1.scala
+++ b/test/files/run/vector1.scala
@@ -9,7 +9,7 @@ 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)
@@ -67,7 +67,7 @@ object Test {
def test1() = {
println("===== test1 =====")
-
+
val N = 150000
val a = vector("a", N)
val b = vectorForward("b", N)
@@ -81,22 +81,22 @@ object Test {
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()
@@ -107,7 +107,7 @@ object Test {
//a.debug
throw ex
}
-
+
assertVector(a, "a", 0, N)
}
@@ -122,14 +122,14 @@ object Test {
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)
}