diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-07-28 15:06:37 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-07-28 15:06:37 +0000 |
commit | db5f08d5bb2ba343bad303b8f165cc51f3b7a51d (patch) | |
tree | 5c9e6686b379a536d52318bb8528283bfeec9012 /test/files | |
parent | 5aeca8a716c2ef31f2e73d0bb3f1767b64a8708b (diff) | |
download | scala-db5f08d5bb2ba343bad303b8f165cc51f3b7a51d.tar.gz scala-db5f08d5bb2ba343bad303b8f165cc51f3b7a51d.tar.bz2 scala-db5f08d5bb2ba343bad303b8f165cc51f3b7a51d.zip |
Added merge function to HashTrie.merge. No review.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/priorityQueue.scala | 36 |
1 files changed, 36 insertions, 0 deletions
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") + } + } |