Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: tests/corelib_strong/sort_test.dart

Issue 2877683002: Adjust types in SplayTree implementation and some strong tests to (Closed)
Patch Set: Bind to variable to enable promotion Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Dart test for sort routines. 5 // Dart test for sort routines.
6 library sort_test; 6 library sort_test;
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'sort_helper.dart'; 9 import 'sort_helper.dart';
10 10
11 main() { 11 main() {
12 var compare = (a, b) => a.compareTo(b); 12 var compare = (num a, num b) => a.compareTo(b);
13 var sort = (list) => list.sort(compare); 13 var sort = (List<num> list) => list.sort(compare);
14 new SortHelper(sort, compare).run(); 14 new SortHelper(sort, compare).run();
15 15
16 compare = (a, b) => -a.compareTo(b); 16 compare = (num a, num b) => -a.compareTo(b);
17 new SortHelper(sort, compare).run(); 17 new SortHelper(sort, compare).run();
18 18
19 var intCompare = (int a, int b) => a.compareTo(b); 19 var intCompare = (int a, int b) => a.compareTo(b);
20 20
21 // Pivot-candidate indices: 7, 15, 22, 29, 37 21 // Pivot-candidate indices: 7, 15, 22, 29, 37
22 // Test Dutch flag partitioning (candidates 2 and 4 are the same). 22 // Test Dutch flag partitioning (candidates 2 and 4 are the same).
23 var list = [ 23 var list = [
24 0, 24 0,
25 0, 25 0,
26 0, 26 0,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 2 /**/, 61 2 /**/,
62 2, 62 2,
63 2, 63 2,
64 2, 64 2,
65 2, 65 2,
66 2, 66 2,
67 2, 67 2,
68 2 68 2
69 ]; 69 ];
70 list.sort(intCompare); 70 list.sort(intCompare);
71 Expect.listEquals(list, [ 71 Expect.listEquals(list, <int>[
72 0, 72 0,
73 0, 73 0,
74 0, 74 0,
75 0, 75 0,
76 0, 76 0,
77 0, 77 0,
78 0, 78 0,
79 0, 79 0,
80 0, 80 0,
81 0, 81 0,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 2 /**/, 157 2 /**/,
158 2, 158 2,
159 2, 159 2,
160 2, 160 2,
161 2, 161 2,
162 2, 162 2,
163 2, 163 2,
164 2 164 2
165 ]; 165 ];
166 list.sort(intCompare); 166 list.sort(intCompare);
167 Expect.listEquals(list, [ 167 Expect.listEquals(list, <int>[
168 0, 168 0,
169 0, 169 0,
170 0, 170 0,
171 0, 171 0,
172 0, 172 0,
173 0, 173 0,
174 0, 174 0,
175 0, 175 0,
176 0, 176 0,
177 0, 177 0,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 8 /**/, 256 8 /**/,
257 5, 257 5,
258 1, 258 1,
259 2, 259 2,
260 8, 260 8,
261 5, 261 5,
262 6, 262 6,
263 8 263 8
264 ]; 264 ];
265 list.sort(intCompare); 265 list.sort(intCompare);
266 Expect.listEquals(list, [ 266 Expect.listEquals(list, <int>[
267 0, 267 0,
268 0, 268 0,
269 0, 269 0,
270 0, 270 0,
271 0, 271 0,
272 1, 272 1,
273 1, 273 1,
274 1, 274 1,
275 1, 275 1,
276 1, 276 1,
(...skipping 27 matching lines...) Expand all
304 8, 304 8,
305 8, 305 8,
306 8, 306 8,
307 9, 307 9,
308 9, 308 9,
309 9, 309 9,
310 9, 310 9,
311 9 311 9
312 ]); 312 ]);
313 } 313 }
OLDNEW
« tests/corelib_strong/sort_helper.dart ('K') | « tests/corelib_strong/sort_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698