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

Unified Diff: base/string_number_conversions_unittest.cc

Issue 4129012: Fix a bug that could occur when converting strings with leading characters ab... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « base/string_number_conversions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_number_conversions_unittest.cc
===================================================================
--- base/string_number_conversions_unittest.cc (revision 63369)
+++ base/string_number_conversions_unittest.cc (working copy)
@@ -80,6 +80,8 @@
} cases[] = {
{"0", 0, true},
{"42", 42, true},
+ {"42\x99", 42, false},
+ {"\x99" "42\x99", 0, false},
{"-2147483648", INT_MIN, true},
{"2147483647", INT_MAX, true},
{"", 0, false},
@@ -161,6 +163,11 @@
utf16_chars + utf16_input.length(),
&output));
EXPECT_EQ(6, output);
+
+ output = 0;
+ const char16 negative_wide_input[] = { 0xFF4D, '4', '2', 0};
MAD 2010/11/02 18:53:25 I was wondering about that... But didn't mention s
erikwright (departed) 2010/11/02 19:32:22 The other one did build on Win (locally), but I wa
+ EXPECT_FALSE(StringToInt(string16(negative_wide_input), &output));
+ EXPECT_EQ(0, output);
}
TEST(StringNumberConversionsTest, StringToInt64) {
« no previous file with comments | « base/string_number_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698