OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
883 {"8.32116e+55", 0x4b8b2628393e02cdULL}, | 883 {"8.32116e+55", 0x4b8b2628393e02cdULL}, |
884 }; | 884 }; |
885 | 885 |
886 for (const auto& test : cases) { | 886 for (const auto& test : cases) { |
887 double output; | 887 double output; |
888 EXPECT_TRUE(StringToDouble(test.input, &output)); | 888 EXPECT_TRUE(StringToDouble(test.input, &output)); |
889 EXPECT_EQ(bit_cast<uint64_t>(output), test.expected); | 889 EXPECT_EQ(bit_cast<uint64_t>(output), test.expected); |
890 } | 890 } |
891 } | 891 } |
892 | 892 |
893 TEST(StringNumberConversionsTest, StringToDoubleHangBug588726) { | |
Lei Zhang
2016/09/23 19:32:16
Just add it to StringNumberConversionsTest.StringT
kcwu
2016/09/23 19:48:03
Done.
| |
894 double output; | |
895 EXPECT_TRUE(StringToDouble( | |
896 "-0.0010000000000000000000000000000000000000001e-256", &output)); | |
897 EXPECT_DOUBLE_EQ(-1.0000000000000001e-259, output); | |
898 } | |
899 | |
893 } // namespace base | 900 } // namespace base |
OLD | NEW |