diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 03:00:48 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 03:00:48 +0000 |
commit | dcbffbacd7e233de6a13876ff99edf323c9bcfa6 (patch) | |
tree | cda2735e7847e944c4e0e01733cbc7b53270a137 /base/string_util_unittest.cc | |
parent | 3ef60118b27baa091fb13a08bc2110b0afd8db82 (diff) | |
download | chromium_src-dcbffbacd7e233de6a13876ff99edf323c9bcfa6.zip chromium_src-dcbffbacd7e233de6a13876ff99edf323c9bcfa6.tar.gz chromium_src-dcbffbacd7e233de6a13876ff99edf323c9bcfa6.tar.bz2 |
Add ToUpperASCII and StringToUpperASCII.
R=darin,eroman
Review URL: http://codereview.chromium.org/28227
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_unittest.cc')
-rw-r--r-- | base/string_util_unittest.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index 2b7634f..9d099ab 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -572,6 +572,32 @@ TEST(StringUtilTest, ConvertASCII) { EXPECT_EQ(0, string_with_nul.compare(narrow_with_nul)); } +TEST(StringUtilTest, ToUpperASCII) { + EXPECT_EQ('C', ToUpperASCII('C')); + EXPECT_EQ('C', ToUpperASCII('c')); + EXPECT_EQ('2', ToUpperASCII('2')); + + EXPECT_EQ(L'C', ToUpperASCII(L'C')); + EXPECT_EQ(L'C', ToUpperASCII(L'c')); + EXPECT_EQ(L'2', ToUpperASCII(L'2')); + + std::string in_place_a("Cc2"); + StringToUpperASCII(&in_place_a); + EXPECT_EQ("CC2", in_place_a); + + std::wstring in_place_w(L"Cc2"); + StringToUpperASCII(&in_place_w); + EXPECT_EQ(L"CC2", in_place_w); + + std::string original_a("Cc2"); + std::string upper_a = StringToUpperASCII(original_a); + EXPECT_EQ("CC2", upper_a); + + std::wstring original_w(L"Cc2"); + std::wstring upper_w = StringToUpperASCII(original_w); + EXPECT_EQ(L"CC2", upper_w); +} + static const struct { const wchar_t* src_w; const char* src_a; |