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

Unified Diff: test/cctest/test-double.cc

Issue 4681001: Fix Double.NextDouble function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years, 1 month 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 | « src/double.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-double.cc
diff --git a/test/cctest/test-double.cc b/test/cctest/test-double.cc
index a7a604ea43367789a330817ea23d428f4477cfd0..3594a4fe32aaedaf53e1eb7ac08157f221d5a928 100644
--- a/test/cctest/test-double.cc
+++ b/test/cctest/test-double.cc
@@ -202,3 +202,19 @@ TEST(NormalizedBoundaries) {
CHECK(diy_fp.f() - boundary_minus.f() == boundary_plus.f() - diy_fp.f());
CHECK((1 << 10) == diy_fp.f() - boundary_minus.f()); // NOLINT
}
+
+
+TEST(NextDouble) {
+ CHECK_EQ(4e-324, Double(0.0).NextDouble());
+ CHECK_EQ(0.0, Double(-0.0).NextDouble());
+ CHECK_EQ(-0.0, Double(-4e-324).NextDouble());
+ Double d0(-4e-324);
+ Double d1(d0.NextDouble());
+ Double d2(d1.NextDouble());
+ CHECK_EQ(-0.0, d1.value());
+ CHECK_EQ(0.0, d2.value());
+ CHECK_EQ(4e-324, d2.NextDouble());
+ CHECK_EQ(-1.7976931348623157e308, Double(-V8_INFINITY).NextDouble());
+ CHECK_EQ(V8_INFINITY,
+ Double(V8_2PART_UINT64_C(0x7fefffff, ffffffff)).NextDouble());
+}
« no previous file with comments | « src/double.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698