OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/case_conversion.h" | 5 #include "base/i18n/case_conversion.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 // Test upper and lower case string conversion. | 11 // Test upper and lower case string conversion. |
12 TEST(CaseConversionTest, UpperLower) { | 12 TEST(CaseConversionTest, UpperLower) { |
13 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); | 13 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); |
14 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); | 14 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); |
15 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); | 15 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); |
16 | 16 |
17 string16 result = base::i18n::ToLower(mixed); | 17 string16 result = base::i18n::ToLower(mixed); |
18 EXPECT_EQ(expected_lower, result); | 18 EXPECT_EQ(expected_lower, result); |
19 | 19 |
20 result = base::i18n::ToUpper(mixed); | 20 result = base::i18n::ToUpper(mixed); |
21 EXPECT_EQ(expected_upper, result); | 21 EXPECT_EQ(expected_upper, result); |
22 } | 22 } |
23 | 23 |
24 // TODO(jshin): More tests are needed, especially with non-ASCII characters. | 24 // TODO(jshin): More tests are needed, especially with non-ASCII characters. |
25 | 25 |
26 } // namespace | 26 } // namespace |
OLD | NEW |