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

Unified Diff: test/cctest/test-random-number-generator.cc

Issue 583153002: Reland 24052 - Require V8 to be explicitly initialized before an Isolate is created (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-macro-assembler-x87.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-random-number-generator.cc
diff --git a/test/cctest/test-random-number-generator.cc b/test/cctest/test-random-number-generator.cc
index d2e67c76977e64978f7793ecba9c3405826b0c13..04b58820a208d71c62e49302a5f15d2168504e83 100644
--- a/test/cctest/test-random-number-generator.cc
+++ b/test/cctest/test-random-number-generator.cc
@@ -34,28 +34,16 @@
using namespace v8::internal;
-static const int kMaxRuns = 12345;
-static const int kRandomSeeds[] = {
- -1, 1, 42, 100, 1234567890, 987654321
-};
+static const int64_t kRandomSeeds[] = {-1, 1, 42, 100, 1234567890, 987654321};
TEST(RandomSeedFlagIsUsed) {
for (unsigned n = 0; n < arraysize(kRandomSeeds); ++n) {
- FLAG_random_seed = kRandomSeeds[n];
+ FLAG_random_seed = static_cast<int>(kRandomSeeds[n]);
v8::Isolate* i = v8::Isolate::New();
- v8::base::RandomNumberGenerator& rng1 =
+ v8::base::RandomNumberGenerator& rng =
*reinterpret_cast<Isolate*>(i)->random_number_generator();
- v8::base::RandomNumberGenerator rng2(kRandomSeeds[n]);
- for (int k = 1; k <= kMaxRuns; ++k) {
- int64_t i1, i2;
- rng1.NextBytes(&i1, sizeof(i1));
- rng2.NextBytes(&i2, sizeof(i2));
- CHECK_EQ(i2, i1);
- CHECK_EQ(rng2.NextInt(), rng1.NextInt());
- CHECK_EQ(rng2.NextInt(k), rng1.NextInt(k));
- CHECK_EQ(rng2.NextDouble(), rng1.NextDouble());
- }
+ CHECK_EQ(kRandomSeeds[n], rng.initial_seed());
i->Dispose();
}
}
« no previous file with comments | « test/cctest/test-macro-assembler-x87.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698