OLD | NEW |
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 = (a, b) => a.compareTo(b); |
13 var sort = (list) => list.sort(compare); | 13 var sort = (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 = (a, b) => -a.compareTo(b); |
17 new SortHelper(sort, compare).run(); | 17 new SortHelper(sort, compare).run(); |
18 | 18 |
19 compare = (a, b) => a.compareTo(b); | 19 compare = (a, b) => a.compareTo(b); |
20 | 20 |
21 // Pivot-canditate indices: 7, 15, 22, 29, 37 | 21 // Pivot-candidate indices: 7, 15, 22, 29, 37 |
22 // Test dutch flag partitioning (canditates 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, |
27 0, | 27 0, |
28 0, | 28 0, |
29 0, | 29 0, |
30 0, | 30 0, |
31 0 /**/, | 31 0 /**/, |
32 0, | 32 0, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |