summaryrefslogtreecommitdiffstats
path: root/base/string_util_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 22:03:26 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 22:03:26 +0000
commit084d46254caf483505ec1bed4e901981eab8caa9 (patch)
tree1a62c9feef037988457c316edca998d2122b9392 /base/string_util_unittest.cc
parent7d85f43054e36a6b30fc95fab0773a59f2b353bd (diff)
downloadchromium_src-084d46254caf483505ec1bed4e901981eab8caa9.zip
chromium_src-084d46254caf483505ec1bed4e901981eab8caa9.tar.gz
chromium_src-084d46254caf483505ec1bed4e901981eab8caa9.tar.bz2
Add some extra test cases for whitespace at start/end of number.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_unittest.cc')
-rw-r--r--base/string_util_unittest.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc
index 837e000..9b0f9b6 100644
--- a/base/string_util_unittest.cc
+++ b/base/string_util_unittest.cc
@@ -671,6 +671,7 @@ TEST(StringUtilTest, StringToInt) {
{"2147483647", INT_MAX, true},
{"", 0, false},
{" 42", 42, false},
+ {"42 ", 42, false},
{"\t\n\v\f\r 42", 42, false},
{"blah42", 0, false},
{"42blah", 42, false},
@@ -734,6 +735,7 @@ TEST(StringUtilTest, StringToInt64) {
{"-09", -9, true},
{"", 0, false},
{" 42", 42, false},
+ {"42 ", 42, false},
{"\t\n\v\f\r 42", 42, false},
{"blah42", 0, false},
{"42blah", 42, false},
@@ -802,6 +804,8 @@ TEST(StringUtilTest, HexStringToInt) {
{"0f", 15, true},
{" 45", 0x45, false},
{"\t\n\v\f\r 0x45", 0x45, false},
+ {" 45", 0x45, false},
+ {"45 ", 0x45, false},
{"efgh", 0xef, false},
{"0xefgh", 0xef, false},
{"hgfe", 0, false},
@@ -853,6 +857,8 @@ TEST(StringUtilTest, StringToDouble) {
{"9e99999999999999999999", HUGE_VAL, false},
{"-9e99999999999999999999", -HUGE_VAL, false},
{"1e-2", 0.01, true},
+ {" 1e-2", 0.01, false},
+ {"1e-2 ", 0.01, false},
{"-1E-7", -0.0000001, true},
{"01e02", 100, true},
{"2.3e15", 2.3e15, true},