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

Unified Diff: tests/corelib/src/CollectionToStringTest.dart

Issue 9431015: Wrote functions to convert collections and maps to strings and invoked (Closed) Base URL: http://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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/src/CollectionToStringTest.dart
===================================================================
--- tests/corelib/src/CollectionToStringTest.dart (revision 4345)
+++ tests/corelib/src/CollectionToStringTest.dart (working copy)
@@ -9,7 +9,7 @@
// TODO(jjb): seed random number generator when API allows it
final int NUM_TESTS = 3000;
-final int MAX_COLLECTION_SIZE = 6;
+final int MAX_COLLECTION_SIZE = 7;
main() {
smokeTest();
@@ -68,9 +68,8 @@
void exactTest() {
for (int i = 0; i < NUM_TESTS; i++) {
// Choose a size from 0 to MAX_COLLECTION_SIZE, favoring larger sizes
- float sqrtSize = Math.sqrt(Math.random() * (MAX_COLLECTION_SIZE + 1));
- int size = (sqrtSize * sqrtSize).toInt();
-
+ int size = Math.sqrt(random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE)).toInt();
+
StringBuffer stringRep = new StringBuffer();
Object o = randomCollection(size, stringRep, exact:true);
Expect.equals(o.toString(), stringRep.toString());
@@ -91,9 +90,8 @@
void inexactTest() {
for (int i = 0; i < NUM_TESTS; i++) {
// Choose a size from 0 to MAX_COLLECTION_SIZE, favoring larger sizes
- float sqrtSize = Math.sqrt(Math.random() * (MAX_COLLECTION_SIZE + 1));
- int size = (sqrtSize * sqrtSize).toInt();
-
+ int size = Math.sqrt(random(MAX_COLLECTION_SIZE * MAX_COLLECTION_SIZE)).toInt();
+
StringBuffer stringRep = new StringBuffer();
Object o = randomCollection(size, stringRep, exact:false);
Expect.equals(alphagram(o.toString()), alphagram(stringRep.toString()));
« no previous file with comments | « runtime/lib/lib_impl_sources.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698