summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArno den Hartog <ac.denhartog@student.maastrichtuniversity.nl>2016-05-02 22:08:35 +0200
committerArno den Hartog <ac.denhartog@student.maastrichtuniversity.nl>2016-05-02 22:08:35 +0200
commit284571c74cac6c01dfa1c4af0d9d92f4f9fb04c0 (patch)
tree2a57de79f389e09e07f4962d1fd217ebf4913529
parent24f68829749eb00fa0cdbd6624dcfa167e5c2ce9 (diff)
downloadscala-284571c74cac6c01dfa1c4af0d9d92f4f9fb04c0.tar.gz
scala-284571c74cac6c01dfa1c4af0d9d92f4f9fb04c0.tar.bz2
scala-284571c74cac6c01dfa1c4af0d9d92f4f9fb04c0.zip
test PriorityQueue.reverse
-rw-r--r--test/junit/scala/collection/mutable/PriorityQueueTest.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/junit/scala/collection/mutable/PriorityQueueTest.scala b/test/junit/scala/collection/mutable/PriorityQueueTest.scala
index a14f1bf4c8..faedcf11f0 100644
--- a/test/junit/scala/collection/mutable/PriorityQueueTest.scala
+++ b/test/junit/scala/collection/mutable/PriorityQueueTest.scala
@@ -14,6 +14,12 @@ class PriorityQueueTest {
priorityQueue.enqueue(elements :_*)
@Test
+ def orderingReverseReverse() {
+ val pq = new mutable.PriorityQueue[Nothing]()((_,_)=>42)
+ assert(pq.ord eq pq.reverse.reverse.ord)
+ }
+
+ @Test
def canSerialize() {
val outputStream = new ByteArrayOutputStream()
new ObjectOutputStream(outputStream).writeObject(priorityQueue)
@@ -27,6 +33,7 @@ class PriorityQueueTest {
val objectInputStream = new ObjectInputStream(new ByteArrayInputStream(bytes))
val deserializedPriorityQueue = objectInputStream.readObject().asInstanceOf[PriorityQueue[Int]]
+ //correct sequencing is also tested here:
assert(deserializedPriorityQueue.dequeueAll == elements.sorted.reverse)
}
}