summaryrefslogtreecommitdiff
path: root/test/files/run/t2849.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-01-11 15:44:22 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-01-11 15:44:22 +0000
commit457fd685569f0d9cd3011e5f5aacf5d58fedb8bc (patch)
tree55b85c4d0e63d70ae2c2e3b20b8e93d9443db69d /test/files/run/t2849.scala
parent60d5bbdf4aafb8a5d49bafc7db2b4481b94ec4f9 (diff)
downloadscala-457fd685569f0d9cd3011e5f5aacf5d58fedb8bc.tar.gz
scala-457fd685569f0d9cd3011e5f5aacf5d58fedb8bc.tar.bz2
scala-457fd685569f0d9cd3011e5f5aacf5d58fedb8bc.zip
Red black tree patch and test.
no review
Diffstat (limited to 'test/files/run/t2849.scala')
-rw-r--r--test/files/run/t2849.scala46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/files/run/t2849.scala b/test/files/run/t2849.scala
new file mode 100644
index 0000000000..68094de736
--- /dev/null
+++ b/test/files/run/t2849.scala
@@ -0,0 +1,46 @@
+
+
+
+import scala.collection.immutable.SortedSet
+import scala.collection.immutable.TreeSet
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ ticketExample
+ similarExample
+ }
+
+ def ticketExample {
+ var big = 100000
+
+ var aSortedSet: SortedSet[Int] = TreeSet(big)
+
+ for (i <- 1 until 10000) {
+ aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1))
+ big = big - 1
+ if (i % 1000 == 0) {
+ aSortedSet.until(i)
+ }
+ }
+ }
+
+ def similarExample {
+ var big = 100
+
+ var aSortedSet: SortedSet[Int] = TreeSet(big)
+
+ for (i <- 1 until 10000) {
+ aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1)) + big
+ big = big - 1
+ if (i % 1000 == 0) {
+ aSortedSet.until(i)
+ }
+ }
+ }
+
+}
+
+