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

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

Issue 14135005: Fix 'collection' tests and co19 dartc/dart2js status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/collection_test.dart ('k') | tests/html/element_classes_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Tests for the toString methods on collections and maps. 6 * Tests for the toString methods on collections and maps.
7 */ 7 */
8 8
9 library collection_to_string; 9 library collection_to_string;
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 /** 200 /**
201 * Populates the given empty collection with elements, emitting the string 201 * Populates the given empty collection with elements, emitting the string
202 * representation of the collection to stringRep. The beingMade parameter is 202 * representation of the collection to stringRep. The beingMade parameter is
203 * a list of collections currently under construction, i.e., candidates for 203 * a list of collections currently under construction, i.e., candidates for
204 * recursive references. 204 * recursive references.
205 * 205 *
206 * If exact is true, the elements of the returned collections will not be, 206 * If exact is true, the elements of the returned collections will not be,
207 * and will not contain a collection with ill-defined iteration order 207 * and will not contain a collection with ill-defined iteration order
208 * (i.e., a HashSet or HashMap). 208 * (i.e., a HashSet or HashMap).
209 */ 209 */
210 Collection populateRandomCollection(int size, bool exact, 210 populateRandomCollection(int size, bool exact,
211 StringBuffer stringRep, List beingMade, Collection coll) { 211 StringBuffer stringRep, List beingMade, var coll) {
212 beingMade.add(coll); 212 beingMade.add(coll);
213 stringRep.write(coll is List ? '[' : '{'); 213 stringRep.write(coll is List ? '[' : '{');
214 214
215 for (int i = 0; i < size; i++) { 215 for (int i = 0; i < size; i++) {
216 if (i != 0) stringRep.write(', '); 216 if (i != 0) stringRep.write(', ');
217 coll.add(randomElement(random(size), exact, stringRep, beingMade)); 217 coll.add(randomElement(random(size), exact, stringRep, beingMade));
218 } 218 }
219 219
220 stringRep.write(coll is List ? ']' : '}'); 220 stringRep.write(coll is List ? ']' : '}');
221 beingMade.removeLast(); 221 beingMade.removeLast();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return rand.nextBool(); 298 return rand.nextBool();
299 } 299 }
300 300
301 /** Returns the alphabetized characters in a string. */ 301 /** Returns the alphabetized characters in a string. */
302 String alphagram(String s) { 302 String alphagram(String s) {
303 // Calling [toList] to convert unmodifiable list to normal list. 303 // Calling [toList] to convert unmodifiable list to normal list.
304 List<int> chars = s.codeUnits.toList(); 304 List<int> chars = s.codeUnits.toList();
305 chars.sort((int a, int b) => a - b); 305 chars.sort((int a, int b) => a - b);
306 return new String.fromCharCodes(chars); 306 return new String.fromCharCodes(chars);
307 } 307 }
OLDNEW
« no previous file with comments | « tests/corelib/collection_test.dart ('k') | tests/html/element_classes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698