summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2009-11-22 22:47:08 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2009-11-22 22:47:08 +0000
commite8e504c0f27d3d594625c9101e5f4fab9b38865e (patch)
treeb851bc91ef09c3c8f10fade81b92b128989cebe8 /test/files
parent9aae43ad9f3f015811d3de8e05dfb521001c244e (diff)
downloadscala-e8e504c0f27d3d594625c9101e5f4fab9b38865e.tar.gz
scala-e8e504c0f27d3d594625c9101e5f4fab9b38865e.tar.bz2
scala-e8e504c0f27d3d594625c9101e5f4fab9b38865e.zip
Priority queue reverse is undefined - overriden...
Priority queue reverse is undefined - overriden to throw an exception. Reverse iterator seems to have sense - it is overriden and is defined, and some methods in SeqLike are implemented in terms of it.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/priorityQueue.scala40
1 files changed, 30 insertions, 10 deletions
diff --git a/test/files/run/priorityQueue.scala b/test/files/run/priorityQueue.scala
index e582448342..54090091ec 100644
--- a/test/files/run/priorityQueue.scala
+++ b/test/files/run/priorityQueue.scala
@@ -21,7 +21,7 @@ object Test {
testDrops
testUpdates
testEquality
- testSeq
+ testMisc
}
def testInsertionsAndEqualities {
@@ -232,9 +232,10 @@ object Test {
assertPriorityDestructive(pq2)
}
- def testSeq {
+ def testMisc {
val pq = new PriorityQueue[Int]
pq ++= (0 until 100)
+ assert(pq.size == 100)
val (p1, p2) = pq.partition(_ < 50)
assertPriorityDestructive(p1)
@@ -246,14 +247,33 @@ object Test {
pq.clear
pq ++= (0 until 10)
pq += 5
- //val ind = pq.lastIndexWhere(_ == 5)
- //println(ind)
- //println(pq)
- //assert(ind == 5)
- //assertPriorityDestructive(pq)
-
- //pq.clear
- //pq ++= (0 until 10)
+ assert(pq.size == 11)
+
+ val ind = pq.lastIndexWhere(_ == 5)
+ assert(ind == 5)
+ assertPriorityDestructive(pq)
+
+ pq.clear
+ pq ++= (0 until 10)
+ assert(pq.lastIndexWhere(_ == 9) == 0)
+ assert(pq.lastIndexOf(8) == 1)
+ assert(pq.lastIndexOf(7) == 2)
+
+ pq += 5
+ pq += 9
+ assert(pq.lastIndexOf(9) == 1)
+ assert(pq.lastIndexWhere(_ % 2 == 1) == 10)
+ assert(pq.lastIndexOf(5) == 6)
+
+ val lst = pq.reverseIterator.toList
+ for (i <- 0 until 5) assert(lst(i) == i)
+ assert(lst(5) == 5)
+ assert(lst(6) == 5)
+ assert(lst(7) == 6)
+ assert(lst(8) == 7)
+ assert(lst(9) == 8)
+ assert(lst(10) == 9)
+ assert(lst(11) == 9)
}
}