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

Side by Side Diff: tests/corelib/src/CollectionToStringTest.dart

Issue 9429032: Fix build breakage caused by the recent toString() commit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « frog/leg/lib/coreimpl.dart ('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) 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 (including maps). 6 * Tests for the toString methods on collections (including maps).
7 */ 7 */
8 8
9 // TODO(jjb): seed random number generator when API allows it 9 // TODO(jjb): seed random number generator when API allows it
10 10
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 /** 249 /**
250 * Generates a random element which can be an int, a collection, or a map, 250 * Generates a random element which can be an int, a collection, or a map,
251 * and emits it to StringRep. The beingMade parameter is a list of collections 251 * and emits it to StringRep. The beingMade parameter is a list of collections
252 * currently under construction, i.e., candidates for recursive references. 252 * currently under construction, i.e., candidates for recursive references.
253 * 253 *
254 * If exact is true, the returned element will not be, and will not contain 254 * If exact is true, the returned element will not be, and will not contain
255 * a collection with ill-defined iteration order (i.e., a HashSet or HashMap). 255 * a collection with ill-defined iteration order (i.e., a HashSet or HashMap).
256 */ 256 */
257 void randomElement(int size, bool exact, StringBuffer stringRep, 257 Object randomElement(int size, bool exact, StringBuffer stringRep,
jjb 2012/02/22 04:55:06 I find it astonishing that the compiler never told
258 List beingMade) { 258 List beingMade) {
259 Object result; 259 Object result;
260 double elementTypeFrac = Math.random(); 260 double elementTypeFrac = Math.random();
261 if (elementTypeFrac < 1/3) { 261 if (elementTypeFrac < 1/3) {
262 result = random(1000); 262 result = random(1000);
263 stringRep.add(result); 263 stringRep.add(result);
264 } else if (elementTypeFrac < 2/3) { 264 } else if (elementTypeFrac < 2/3) {
265 // Element Is a random (new) collection 265 // Element Is a random (new) collection
266 result = randomCollectionHelper(size, exact, stringRep, beingMade); 266 result = randomCollectionHelper(size, exact, stringRep, beingMade);
267 } else { 267 } else {
(...skipping 16 matching lines...) Expand all
284 bool randomBool() { 284 bool randomBool() {
285 return Math.random() < .5; 285 return Math.random() < .5;
286 } 286 }
287 287
288 /** Returns the alphabetized characters in a string. */ 288 /** Returns the alphabetized characters in a string. */
289 String alphagram(String s) { 289 String alphagram(String s) {
290 List<int> chars = s.charCodes(); 290 List<int> chars = s.charCodes();
291 chars.sort((int a, int b) => a - b); 291 chars.sort((int a, int b) => a - b);
292 return new String.fromCharCodes(chars); 292 return new String.fromCharCodes(chars);
293 } 293 }
OLDNEW
« no previous file with comments | « frog/leg/lib/coreimpl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698