Index: tests/corelib_strong/sort_helper.dart |
diff --git a/tests/corelib_strong/sort_helper.dart b/tests/corelib_strong/sort_helper.dart |
index 9c730177ea24c9a67796390f22ad0a72c9a7287f..945f6356a7321ec312253e56c8b63e9bec997ba6 100644 |
--- a/tests/corelib_strong/sort_helper.dart |
+++ b/tests/corelib_strong/sort_helper.dart |
@@ -6,6 +6,11 @@ library sort_helper; |
import "package:expect/expect.dart"; |
+typedef Sorter |
+ = void Function(List<num>); |
Lasse Reichstein Nielsen
2017/05/11 22:23:36
This should just be on one line.
Is dartfmt doing
Leaf
2017/05/12 00:22:34
https://github.com/dart-lang/sdk/issues/29603
|
+typedef Comparer |
+ = int Function(num, num); |
+ |
class SortHelper { |
SortHelper(this.sortFunction, this.compareFunction) {} |
@@ -14,7 +19,7 @@ class SortHelper { |
testSortDoubleLists(); |
} |
- bool isSorted(List a) { |
+ bool isSorted(List<num> a) { |
for (int i = 1; i < a.length; i++) { |
if (compareFunction(a[i - 1], a[i]) > 0) { |
return false; |
@@ -24,7 +29,7 @@ class SortHelper { |
} |
void testSortIntLists() { |
- List a = new List(40); |
+ var a = new List<int>(40); |
for (int i = 0; i < a.length; i++) { |
a[i] = i; |
@@ -80,10 +85,10 @@ class SortHelper { |
a[33] = 1; |
testSort(a); |
- var a2 = new List(0); |
+ var a2 = new List<int>(0); |
testSort(a2); |
- var a3 = new List(1); |
+ var a3 = new List<int>(1); |
a3[0] = 1; |
testSort(a3); |
@@ -115,13 +120,13 @@ class SortHelper { |
testInsertionSort(3, 2, 0, 1); |
} |
- void testSort(List a) { |
+ void testSort(List<num> a) { |
sortFunction(a); |
Expect.isTrue(isSorted(a)); |
} |
void testInsertionSort(int i1, int i2, int i3, int i4) { |
- var a = new List(4); |
+ var a = new List<int>(4); |
a[0] = i1; |
a[1] = i2; |
a[2] = i3; |
@@ -130,7 +135,7 @@ class SortHelper { |
} |
void testSortDoubleLists() { |
- List a = new List(40); |
+ var a = new List<double>(40); |
for (int i = 0; i < a.length; i++) { |
a[i] = 1.0 * i + 0.5; |
} |
@@ -147,6 +152,6 @@ class SortHelper { |
testSort(a); |
} |
- Function sortFunction; |
- Function compareFunction; |
+ Sorter sortFunction; |
+ Comparer compareFunction; |
} |