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

Side by Side Diff: tests/lib_2/math/random_secure_test.dart

Issue 2995343002: Migrated test block 216 to Dart 2.0. (Closed)
Patch Set: Migrated min_max_test to Dart 2.0 Created 3 years, 3 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
« no previous file with comments | « tests/lib_2/math/random_big_test.dart ('k') | tests/lib_2/math/random_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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Test that the secure random generator does not systematically generates 5 // Test that the secure random generator does not systematically generates
6 // duplicates. Note that this test is flaky by definition, since duplicates 6 // duplicates. Note that this test is flaky by definition, since duplicates
7 // can occur. They should be extremely rare, though. 7 // can occur. They should be extremely rare, though.
8 8
9 // Library tag to allow Dartium to run the test. 9 // Library tag to allow Dartium to run the test.
10 library random_secure; 10 library random_secure;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 var cnt1 = 0; 52 var cnt1 = 0;
53 rng0 = new Random.secure(); 53 rng0 = new Random.secure();
54 for (var i = 0; i < 32; i++) { 54 for (var i = 0; i < 32; i++) {
55 rng1 = new Random.secure(); 55 rng1 = new Random.secure();
56 cnt0 += rng0.nextBool() ? 1 : 0; 56 cnt0 += rng0.nextBool() ? 1 : 0;
57 cnt1 += rng1.nextBool() ? 1 : 0; 57 cnt1 += rng1.nextBool() ? 1 : 0;
58 } 58 }
59 Expect.isTrue((cnt0 > 0) && (cnt0 < 32)); 59 Expect.isTrue((cnt0 > 0) && (cnt0 < 32));
60 Expect.isTrue((cnt1 > 0) && (cnt1 < 32)); 60 Expect.isTrue((cnt1 > 0) && (cnt1 < 32));
61 } 61 }
OLDNEW
« no previous file with comments | « tests/lib_2/math/random_big_test.dart ('k') | tests/lib_2/math/random_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698