Blink roll 178200:178213
[chromium-blink-merge.git] / base / i18n / case_conversion_unittest.cc
blob38e2c6878228de468124d80a7aabfddebf2eec0f
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
3 // found in the LICENSE file.
5 #include "base/i18n/case_conversion.h"
6 #include "base/strings/utf_string_conversions.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace base {
10 namespace {
12 // Test upper and lower case string conversion.
13 TEST(CaseConversionTest, UpperLower) {
14 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE."));
15 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case."));
16 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE."));
18 string16 result = base::i18n::ToLower(mixed);
19 EXPECT_EQ(expected_lower, result);
21 result = base::i18n::ToUpper(mixed);
22 EXPECT_EQ(expected_upper, result);
25 // TODO(jshin): More tests are needed, especially with non-ASCII characters.
27 } // namespace
28 } // namespace base