Index: base/strings/string_number_conversions_unittest.cc |
diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc |
index 0576302a0798c98329531d27370a9bd15488ebdf..728537440f3d8292a4d63d30f7315f33d6c54826 100644 |
--- a/base/strings/string_number_conversions_unittest.cc |
+++ b/base/strings/string_number_conversions_unittest.cc |
@@ -890,4 +890,25 @@ TEST(StringNumberConversionsTest, StrtodFailures) { |
} |
} |
+TEST(StringNumberConversionsTest, StringToDoubleBugs) { |
+ static const struct { |
+ std::string input; |
+ double output; |
+ bool success; |
+ } cases[] = { |
+ // crbug.com/588726 timeout |
+ {"-0.0010000000000000000000000000000000000000001e-256", |
+ -1.0000000000000001e-259, true}, |
+ }; |
+ |
+ for (size_t i = 0; i < arraysize(cases); ++i) { |
scottmg
2016/09/23 18:12:40
Since there's only one case, it would be clearer t
kcwu
2016/09/23 19:23:06
Done.
|
+ double output; |
+ errno = 1; |
+ EXPECT_EQ(cases[i].success, StringToDouble(cases[i].input, &output)); |
+ if (cases[i].success) |
+ EXPECT_EQ(1, errno) << i; // confirm that errno is unchanged. |
+ EXPECT_DOUBLE_EQ(cases[i].output, output); |
+ } |
+} |
+ |
} // namespace base |