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

Unified Diff: tests/lib/math/random_test.dart

Issue 21966003: Adapt Random class to be able to run in javascript integer compatibility mode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
« runtime/vm/object.h ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/math/random_test.dart
===================================================================
--- tests/lib/math/random_test.dart (revision 25742)
+++ tests/lib/math/random_test.dart (working copy)
@@ -47,6 +47,12 @@
Expect.equals(2134030067, rnd.nextInt(1 << ++i));
Expect.equals(721180690, rnd.nextInt(1 << ++i));
Expect.equals(32, i);
- // If max is too large expect an ArgumentError.
+ // If max is too large expect an ArgumentError.
Expect.throws(() => rnd.nextInt((1 << i)+1), (e) => e is ArgumentError);
+
+ rnd = new Random(6790);
+ Expect.approxEquals(0.7360144236, rnd.nextDouble());
+ Expect.approxEquals(0.3292339731, rnd.nextDouble());
+ Expect.approxEquals(0.3489622548, rnd.nextDouble());
+ Expect.approxEquals(0.9815975892, rnd.nextDouble());
}
« runtime/vm/object.h ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698