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..6b8307bb7054e991be18168ced339f7ffec5bb1e 100644 |
--- a/tests/corelib_strong/sort_helper.dart |
+++ b/tests/corelib_strong/sort_helper.dart |
@@ -6,6 +6,9 @@ library sort_helper; |
import "package:expect/expect.dart"; |
+typedef Sorter = void Function(List<num>); |
+typedef Comparer = int Function(num, num); |
+ |
class SortHelper { |
SortHelper(this.sortFunction, this.compareFunction) {} |
@@ -14,7 +17,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 +27,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 +83,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 +118,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 +133,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 +150,6 @@ class SortHelper { |
testSort(a); |
} |
- Function sortFunction; |
- Function compareFunction; |
+ Sorter sortFunction; |
+ Comparer compareFunction; |
} |