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