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

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

Issue 3564011: During StringToDouble negative exponents may be less than -999 with a result ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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') | no next file » | 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 5591)
+++ test/cctest/test-conversions.cc (working copy)
@@ -168,7 +168,39 @@
CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
}
+TEST(MinimumExponent) {
+ // Same test but with different point-position.
+ char num[] =
+ "445014771701440202508199667279499186358524265859260511351695091"
+ "228726223124931264069530541271189424317838013700808305231545782"
+ "515453032382772695923684574304409936197089118747150815050941806"
+ "048037511737832041185193533879641611520514874130831632725201246"
+ "060231058690536206311752656217652146466431814205051640436322226"
+ "680064743260560117135282915796422274554896821334728738317548403"
+ "413978098469341510556195293821919814730032341053661708792231510"
+ "873354131880491105553390278848567812190177545006298062245710295"
+ "816371174594568773301103242116891776567137054973871082078224775"
+ "842509670618916870627821633352993761380751142008862499795052791"
+ "018709663463944015644907297315659352441231715398102212132212018"
+ "470035807616260163568645811358486831521563686919762403704226016"
+ "998291015625000000000000000000000000000000000e-1108";
+ CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
+
+ // Changes the result of strtod (at least in glibc implementation).
+ num[sizeof(num) - 8] = '1';
+
+ CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
+}
+
+
+TEST(MaximumExponent) {
+ char num[] = "0.16e309";
+
+ CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
+}
+
+
TEST(ExponentNumberStr) {
CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS));
CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS));
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698