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

Side by Side Diff: tests/corelib/sort_helper.dart

Issue 10701078: Print even less. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class SortHelper { 5 class SortHelper {
6 6
7 SortHelper(this.sortFunction, this.compareFunction) {} 7 SortHelper(this.sortFunction, this.compareFunction) {}
8 8
9 void run() { 9 void run() {
10 testSortIntLists(); 10 testSortIntLists();
11 testSortDoubleLists(); 11 testSortDoubleLists();
12 } 12 }
13 13
14 void printList(List a) { 14 void printList(List a) {
15 if (true) return;
16 StringBuffer buffer = new StringBuffer(); 15 StringBuffer buffer = new StringBuffer();
17 for (int i = 0; i < a.length; i++) { 16 for (int i = 0; i < a.length; i++) {
18 if (i != 0) buffer.add(","); 17 if (i != 0) buffer.add(",");
19 buffer.add(a[i]); 18 buffer.add(a[i]);
20 } 19 }
21 print("[$buffer]"); 20 print("[$buffer]");
22 } 21 }
23 22
24 bool isSorted(List a) { 23 bool isSorted(List a) {
25 for (int i = 1; i < a.length; i++) { 24 for (int i = 1; i < a.length; i++) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 testInsertionSort(2, 3, 0, 1); 115 testInsertionSort(2, 3, 0, 1);
117 testInsertionSort(3, 0, 1, 2); 116 testInsertionSort(3, 0, 1, 2);
118 testInsertionSort(3, 0, 2, 1); 117 testInsertionSort(3, 0, 2, 1);
119 testInsertionSort(3, 1, 2, 0); 118 testInsertionSort(3, 1, 2, 0);
120 testInsertionSort(3, 1, 0, 2); 119 testInsertionSort(3, 1, 0, 2);
121 testInsertionSort(3, 2, 1, 0); 120 testInsertionSort(3, 2, 1, 0);
122 testInsertionSort(3, 2, 0, 1); 121 testInsertionSort(3, 2, 0, 1);
123 } 122 }
124 123
125 void testSort(List a) { 124 void testSort(List a) {
126 printList(a); 125 final bool log = false;
126 if (log) printList(a);
127 sortFunction(a); 127 sortFunction(a);
128 printList(a); 128 if (log) printList(a);
129 bool sorted = isSorted(a); 129 bool sorted = isSorted(a);
130 Expect.equals(true, sorted); 130 Expect.equals(true, sorted);
131 print(sorted); 131 if (log) print(sorted);
132 } 132 }
133 133
134 void testInsertionSort(int i1, int i2, int i3, int i4) { 134 void testInsertionSort(int i1, int i2, int i3, int i4) {
135 var a = new List(4); 135 var a = new List(4);
136 a[0] = i1; 136 a[0] = i1;
137 a[1] = i2; 137 a[1] = i2;
138 a[2] = i3; 138 a[2] = i3;
139 a[3] = i4; 139 a[3] = i4;
140 testSort(a); 140 testSort(a);
141 } 141 }
(...skipping 12 matching lines...) Expand all
154 154
155 for (int i = 0; i < a.length; i++) { 155 for (int i = 0; i < a.length; i++) {
156 a[i] = 1.5; 156 a[i] = 1.5;
157 } 157 }
158 testSort(a); 158 testSort(a);
159 } 159 }
160 160
161 Function sortFunction; 161 Function sortFunction;
162 Function compareFunction; 162 Function compareFunction;
163 } 163 }
OLDNEW
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698