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

Unified Diff: tests/corelib_strong/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_strong/shuffle_test.dart
diff --git a/tests/corelib_strong/shuffle_test.dart b/tests/corelib_strong/shuffle_test.dart
index 7f67911d895d03d85ca1d9fb2975b79dfe366d80..2836c427487215a8c30fe3a07eb991b816830145 100644
--- a/tests/corelib_strong/shuffle_test.dart
+++ b/tests/corelib_strong/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";
@@ -25,11 +26,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.");
@@ -53,7 +55,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 {
@@ -76,7 +78,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;
@@ -92,7 +96,6 @@ void testShuffle(list) {
}
}
-
// Checks that the "random" argument to shuffle is used.
testRandom() {
List<int> randomNums = [37, 87, 42, 157, 252, 17];

Powered by Google App Engine
This is Rietveld 408576698