diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-04-13 19:21:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 19:21:08 +0200 |
commit | 975f7efab69e8e5a23db665f33dceecb0bf6ceaa (patch) | |
tree | da35c6ff938655ab93c791980ef98d4ae8cb4cca /tests/disabled/long-running/t3242.scala | |
parent | 889ed89312cbe70040df92e84432853d38906308 (diff) | |
parent | 623a1d43155823cc7506c3223405bb68f459fd50 (diff) | |
download | dotty-975f7efab69e8e5a23db665f33dceecb0bf6ceaa.tar.gz dotty-975f7efab69e8e5a23db665f33dceecb0bf6ceaa.tar.bz2 dotty-975f7efab69e8e5a23db665f33dceecb0bf6ceaa.zip |
Merge pull request #2251 from dotty-staging/fix-#2220
Fix #2220: disable benchmarks, set run timeout to 30 seconds
Diffstat (limited to 'tests/disabled/long-running/t3242.scala')
-rw-r--r-- | tests/disabled/long-running/t3242.scala | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/disabled/long-running/t3242.scala b/tests/disabled/long-running/t3242.scala new file mode 100644 index 000000000..6a8ecd7a2 --- /dev/null +++ b/tests/disabled/long-running/t3242.scala @@ -0,0 +1,52 @@ + +import scala.language.{ higherKinds } + +object Test { + + def benchmarkA(num: Int): Unit = { + + type A = Int + + def updateM[M[_]](ms: M[A], update: (M[A], A)=>M[A]): M[A] = { + var is = ms + for (i <- 0 until num) is = update(is, i) + is + } + + // + def vectorAppend: Vector[A] = updateM[Vector](Vector(), (as, a)=>{ + val v = (as :+ a) + //println("==>append: i: "+i1+", v: "+v) + v + }) + // this will crash, Vector bug! + def vectorRemove(vec: Vector[A]): Vector[A] = updateM[Vector](vec, (as, a)=>{ + val v = (as filterNot{ _ == a}) + //val v = (is filter{ _ != i}) + //println("==>remove: i: "+a) + v + }) + + val ct = vectorAppend + println(" append [num: "+num+"] vec") + vectorRemove(ct) + println(" remove [num: "+num+"] vec") + } // BenchmarkA + + def comparison(num: Int): Unit = { + for (i <- 1 until 5) benchmarkA(num*i) + println(">> comparison done, num: "+num); + } + + def main(args: Array[String]): Unit = { + try { + //createBenchmarkA(23).testRun + + comparison(200) // OK + comparison(2000) // this will crach + + } catch { + case e: Exception => e.printStackTrace() + } + } +} |