| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library queue_test; | 5 library queue_test; |
| 6 | 6 |
| 7 class QueueTest { | 7 class QueueTest { |
| 8 | 8 |
| 9 static testMain() { | 9 static testMain() { |
| 10 Queue queue = new Queue(); | 10 Queue queue = new Queue(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 checkQueue(queue, 3, 1110); | 34 checkQueue(queue, 3, 1110); |
| 35 | 35 |
| 36 int mapTest(int value) { | 36 int mapTest(int value) { |
| 37 return value ~/ 10; | 37 return value ~/ 10; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool is10(int value) { | 40 bool is10(int value) { |
| 41 return (value == 10); | 41 return (value == 10); |
| 42 } | 42 } |
| 43 | 43 |
| 44 Queue mapped = queue.mappedBy(mapTest); | 44 Queue mapped = new Queue.from(queue.mappedBy(mapTest)); |
| 45 checkQueue(mapped, 3, 111); | 45 checkQueue(mapped, 3, 111); |
| 46 checkQueue(queue, 3, 1110); | 46 checkQueue(queue, 3, 1110); |
| 47 Expect.equals(1, mapped.removeFirst()); | 47 Expect.equals(1, mapped.removeFirst()); |
| 48 Expect.equals(100, mapped.removeLast()); | 48 Expect.equals(100, mapped.removeLast()); |
| 49 Expect.equals(10, mapped.removeFirst()); | 49 Expect.equals(10, mapped.removeFirst()); |
| 50 | 50 |
| 51 Queue other = queue.where(is10); | 51 Queue other = queue.where(is10); |
| 52 checkQueue(other, 1, 10); | 52 checkQueue(other, 1, 10); |
| 53 | 53 |
| 54 Expect.equals(true, queue.some(is10)); | 54 Expect.equals(true, queue.some(is10)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 entry1 = entry1.nextEntry(); | 177 entry1 = entry1.nextEntry(); |
| 178 entry2 = entry2.nextEntry(); | 178 entry2 = entry2.nextEntry(); |
| 179 } | 179 } |
| 180 Expect.equals(null, entry2); | 180 Expect.equals(null, entry2); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 main() { | 184 main() { |
| 185 QueueTest.testMain(); | 185 QueueTest.testMain(); |
| 186 } | 186 } |
| OLD | NEW |