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

Unified Diff: tests/corelib/shuffle_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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 side-by-side diff with in-line comments
Download patch
Index: tests/corelib/shuffle_test.dart
diff --git a/tests/corelib/shuffle_test.dart b/tests/corelib/shuffle_test.dart
index 536072d3c13fcdcfc21ee4c194d6924696a43817..09281ef21c660cfc5b83bee9b8afe4a6cd5c7305 100644
--- a/tests/corelib/shuffle_test.dart
+++ b/tests/corelib/shuffle_test.dart
@@ -4,6 +4,7 @@
// Dart test for List.shuffle.
library shuffle_test;
+
import "dart:typed_data";
import "dart:math" show Random;
import "package:expect/expect.dart";
@@ -27,11 +28,12 @@ main() {
// Check that it actually can keep the same list (regression test).
List l = [1, 2];
- success: {
+ success:
+ {
for (int i = 0; i < 266; i++) {
int first = l.first;
l.shuffle();
- if (l.first == first) break success; // List didn't change.
+ if (l.first == first) break success; // List didn't change.
}
// Chance of changing 266 times in a row should be < 1:1e80.
Expect.fail("List changes every time.");
@@ -55,7 +57,7 @@ void testShuffle(list) {
}
for (var e in copy) {
int remaining = seen[e];
- remaining -= 1; // Throws if e was not in map at all.
+ remaining -= 1; // Throws if e was not in map at all.
if (remaining == 0) {
seen.remove(e);
} else {
@@ -78,7 +80,9 @@ void testShuffle(list) {
}
return false;
}
- if (list.length < 59) { // 59! > 1e80.
+
+ if (list.length < 59) {
+ // 59! > 1e80.
double limit = 1e80;
double fact = 1.0;
for (int i = 2; i < list.length; i++) fact *= i;
@@ -94,7 +98,6 @@ void testShuffle(list) {
}
}
-
// Checks that the "random" argument to shuffle is used.
testRandom() {
List randomNums = [37, 87, 42, 157, 252, 17];

Powered by Google App Engine
This is Rietveld 408576698