| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Tests priority queue implementations utilities. | 5 /// Tests priority queue implementations utilities. |
| 6 | 6 |
| 7 import "package:collection/priority_queue.dart"; | 7 import "package:collection/priority_queue.dart"; |
| 8 import "package:unittest/unittest.dart"; | 8 import "package:test/test.dart"; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| 11 testInt(() => new HeapPriorityQueue<int>()); | 11 testInt(() => new HeapPriorityQueue<int>()); |
| 12 testCustom((comparator) => new HeapPriorityQueue<C>(comparator)); | 12 testCustom((comparator) => new HeapPriorityQueue<C>(comparator)); |
| 13 } | 13 } |
| 14 | 14 |
| 15 void testInt(PriorityQueue<int> create()) { | 15 void testInt(PriorityQueue<int> create()) { |
| 16 for (int count in [1, 5, 127, 128]) { | 16 for (int count in [1, 5, 127, 128]) { |
| 17 testQueue("int:$count", | 17 testQueue("int:$count", |
| 18 create, | 18 create, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 int compareNeg(C c1, C c2) => c2.value - c1.value; | 157 int compareNeg(C c1, C c2) => c2.value - c1.value; |
| 158 | 158 |
| 159 class C implements Comparable { | 159 class C implements Comparable { |
| 160 final int value; | 160 final int value; |
| 161 const C(this.value); | 161 const C(this.value); |
| 162 int get hashCode => value; | 162 int get hashCode => value; |
| 163 bool operator==(Object other) => other is C && value == other.value; | 163 bool operator==(Object other) => other is C && value == other.value; |
| 164 int compareTo(C other) => value - other.value; | 164 int compareTo(C other) => value - other.value; |
| 165 String toString() => "C($value)"; | 165 String toString() => "C($value)"; |
| 166 } | 166 } |
| OLD | NEW |