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

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

Issue 10820047: Make sure double to int conversion is correct. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments. Created 8 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
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-utils.cc
diff --git a/test/cctest/test-utils.cc b/test/cctest/test-utils.cc
index df8ff72e4f3eafed1e85aad150b2ce0d0a93f409..6cd931da4e5822e9c9368b4f16741ebdbe53c296 100644
--- a/test/cctest/test-utils.cc
+++ b/test/cctest/test-utils.cc
@@ -55,6 +55,22 @@ TEST(Utils1) {
CHECK_EQ(-2, -8 >> 2);
CHECK_EQ(-2, static_cast<int8_t>(-8) >> 2);
CHECK_EQ(-2, static_cast<int>(static_cast<intptr_t>(-8) >> 2));
+
+ CHECK_EQ(-1000000, FastD2IChecked(-1000000.0));
+ CHECK_EQ(-1, FastD2IChecked(-1.0));
+ CHECK_EQ(0, FastD2IChecked(0.0));
+ CHECK_EQ(1, FastD2IChecked(1.0));
+ CHECK_EQ(1000000, FastD2IChecked(1000000.0));
+
+ CHECK_EQ(-1000000, FastD2IChecked(-1000000.123));
+ CHECK_EQ(-1, FastD2IChecked(-1.234));
+ CHECK_EQ(0, FastD2IChecked(0.345));
+ CHECK_EQ(1, FastD2IChecked(1.234));
+ CHECK_EQ(1000000, FastD2IChecked(1000000.123));
+
+ CHECK_EQ(INT_MAX, FastD2IChecked(1.0e100));
+ CHECK_EQ(INT_MIN, FastD2IChecked(-1.0e100));
+ CHECK_EQ(INT_MIN, FastD2IChecked(NAN));
}
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698