summaryrefslogtreecommitdiffstats
path: root/base/i18n/case_conversion_unittest.cc
blob: 38e2c6878228de468124d80a7aabfddebf2eec0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/i18n/case_conversion.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace {

// Test upper and lower case string conversion.
TEST(CaseConversionTest, UpperLower) {
  string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE."));
  const string16 expected_lower(ASCIIToUTF16("text with upper & lower case."));
  const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE."));

  string16 result = base::i18n::ToLower(mixed);
  EXPECT_EQ(expected_lower, result);

  result = base::i18n::ToUpper(mixed);
  EXPECT_EQ(expected_upper, result);
}

// TODO(jshin): More tests are needed, especially with non-ASCII characters.

}  // namespace
}  // namespace base