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

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

Issue 1269003: Revert revisions 4241, 4243 and 4247 because of Windows build errors... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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/conversions.cc ('k') | test/mjsunit/str-to-num.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-conversions.cc
===================================================================
--- test/cctest/test-conversions.cc (revision 4248)
+++ test/cctest/test-conversions.cc (working copy)
@@ -41,10 +41,6 @@
CHECK_EQ(7.0, StringToDouble("07", ALLOW_HEX));
CHECK_EQ(10.0, StringToDouble("010", ALLOW_HEX));
CHECK_EQ(77.0, StringToDouble("077", ALLOW_HEX));
-
- const double x = 010000000000; // Power of 2, no rounding errors.
- CHECK_EQ(x * x * x * x * x, StringToDouble("01" "0000000000" "0000000000"
- "0000000000" "0000000000" "0000000000", ALLOW_OCTALS));
}
@@ -84,8 +80,6 @@
TEST(TrailingJunk) {
CHECK_EQ(8.0, StringToDouble("8q", ALLOW_TRAILING_JUNK));
CHECK_EQ(63.0, StringToDouble("077qqq", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
- CHECK_EQ(10.0, StringToDouble("10e", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
- CHECK_EQ(10.0, StringToDouble("10e-", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
}
@@ -97,80 +91,6 @@
CHECK_EQ(0.0, StringToDouble(" ", NO_FLAGS));
}
-TEST(IntegerStrLiteral) {
- CHECK_EQ(0.0, StringToDouble("0.0", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("0", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("00", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("000", NO_FLAGS));
- CHECK_EQ(1.0, StringToDouble("1", NO_FLAGS));
- CHECK_EQ(-1.0, StringToDouble("-1", NO_FLAGS));
- CHECK_EQ(-1.0, StringToDouble(" - 1 ", NO_FLAGS));
- CHECK_EQ(1.0, StringToDouble(" + 1 ", NO_FLAGS));
-}
-
-TEST(LongNumberStr) {
- CHECK_EQ(1e10, StringToDouble("1" "0000000000", NO_FLAGS));
- CHECK_EQ(1e20, StringToDouble("1" "0000000000" "0000000000", NO_FLAGS));
-
- CHECK_EQ(1e60, StringToDouble("1" "0000000000" "0000000000" "0000000000"
- "0000000000" "0000000000" "0000000000", NO_FLAGS));
-
- CHECK_EQ(1e-2, StringToDouble("." "0" "1", NO_FLAGS));
- CHECK_EQ(1e-11, StringToDouble("." "0000000000" "1", NO_FLAGS));
- CHECK_EQ(1e-21, StringToDouble("." "0000000000" "0000000000" "1", NO_FLAGS));
-
- CHECK_EQ(1e-61, StringToDouble("." "0000000000" "0000000000" "0000000000"
- "0000000000" "0000000000" "0000000000" "1", NO_FLAGS));
-
-
- // x = 24414062505131248.0 and y = 24414062505131252.0 are representable in
- // double. Check chat z = (x + y) / 2 is rounded to x...
- CHECK_EQ(24414062505131248.0,
- StringToDouble("24414062505131250.0", NO_FLAGS));
-
- // ... and z = (x + y) / 2 + delta is rounded to y.
- CHECK_EQ(24414062505131252.0,
- StringToDouble("24414062505131250.000000001", NO_FLAGS));
-}
-
-
-TEST(MaximumSignificantDigits) {
- // Smallest possible double
- double min_double = 1 * pow(2, -1023) * pow(2, -51);
- CHECK_NE(min_double, 0.0);
- CHECK_EQ(min_double / 2, 0.0);
-
- // Maximum odd double (any breater number is rounded to even).
- double big_num = (pow(2, 52) - 1) * 2.0 + 1.0;
- CHECK_NE(big_num, big_num - 1.0);
-
- // Numbers with longest possible decimal representation.
- long double a = min_double * big_num;
- long double b = min_double * (big_num - 1);
- CHECK(a != b);
-
- char buffer[1100];
- // Construct a number exactly at the middle between 2 possible
- // doubles with long decimal representation (~760 significant digits).
- int n = snprintf(buffer, sizeof(buffer), "%.1000Le", (a + b) / 2);
-
- CHECK_EQ(strcmp(buffer + n - 10, "00000e-308"), 0);
- CHECK_EQ(b, StringToDouble(buffer, NO_FLAGS));
-
- buffer[n - 8] = '1';
- CHECK_EQ(a, StringToDouble(buffer, NO_FLAGS));
-}
-
-
-TEST(ExponentNumberStr) {
- CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS));
- CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS));
- CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS));
- CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS));
- CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS));
- CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS));
-}
-
class OneBit1: public BitField<uint32_t, 0, 1> {};
class OneBit2: public BitField<uint32_t, 7, 1> {};
class EightBit1: public BitField<uint32_t, 0, 8> {};
« no previous file with comments | « src/conversions.cc ('k') | test/mjsunit/str-to-num.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698