From db5f08d5bb2ba343bad303b8f165cc51f3b7a51d Mon Sep 17 00:00:00 2001 From: Aleksandar Pokopec Date: Wed, 28 Jul 2010 15:06:37 +0000 Subject: Added merge function to HashTrie.merge. No review. --- test/files/run/priorityQueue.scala | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/files/run') diff --git a/test/files/run/priorityQueue.scala b/test/files/run/priorityQueue.scala index 20f7a3cb44..e47e7c8616 100644 --- a/test/files/run/priorityQueue.scala +++ b/test/files/run/priorityQueue.scala @@ -23,6 +23,8 @@ object Test { testEquality testMisc testReverse + testToList + testForeach } def testInsertionsAndEqualities { @@ -325,6 +327,40 @@ object Test { assertPriorityDestructive(iq.reverse.reverse) } + def testToList { + val pq = new PriorityQueue[Int] + + pq += 1 + pq += 4 + pq += 0 + pq += 5 + pq += 3 + pq += 2 + assert(pq.toList == pq) + assert(pq == List(5, 4, 3, 2, 1, 0)) + assert(pq.reverse == List(0, 1, 2, 3, 4, 5)) + + pq.clear + for (i <- -50 until 50) pq += i + assert(pq.toList == pq) + assert(pq.toList == (-50 until 50).reverse) + } + + def testForeach { + val pq = new PriorityQueue[Char] + + pq += 't' + pq += 'o' + pq += 'b' + pq += 'y' + val sbf = new StringBuilder + val sbi = new StringBuilder + pq.foreach(sbf += _) + pq.iterator.foreach(sbi += _) + assert(sbf.toString == sbi.toString) + assert(sbf.toString == "ytob") + } + } -- cgit v1.2.3