1 // Copyright 2017 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.
4 
5 #include "net/base/net_string_util.h"
6 
7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace net {
12 
TEST(NetStringUtilTest,ToUpperEmpty)13 TEST(NetStringUtilTest, ToUpperEmpty) {
14   base::string16 in;
15   base::string16 out;
16   base::string16 expected;
17   ASSERT_TRUE(ToUpper(in, &out));
18   ASSERT_EQ(expected, out);
19 }
20 
TEST(NetStringUtilTest,ToUpperSingleChar)21 TEST(NetStringUtilTest, ToUpperSingleChar) {
22   base::string16 in(base::WideToUTF16(L"a"));
23   base::string16 out;
24   base::string16 expected(base::WideToUTF16(L"A"));
25   ASSERT_TRUE(ToUpper(in, &out));
26   ASSERT_EQ(expected, out);
27 }
28 
TEST(NetStringUtilTest,ToUpperSimple)29 TEST(NetStringUtilTest, ToUpperSimple) {
30   base::string16 in(base::WideToUTF16(L"hello world"));
31   base::string16 out;
32   base::string16 expected(base::WideToUTF16(L"HELLO WORLD"));
33   ASSERT_TRUE(ToUpper(in, &out));
34   ASSERT_EQ(expected, out);
35 }
36 
TEST(NetStringUtilTest,ToUpperAlreadyUpper)37 TEST(NetStringUtilTest, ToUpperAlreadyUpper) {
38   base::string16 in(base::WideToUTF16(L"HELLO WORLD"));
39   base::string16 out;
40   base::string16 expected(base::WideToUTF16(L"HELLO WORLD"));
41   ASSERT_TRUE(ToUpper(in, &out));
42   ASSERT_EQ(expected, out);
43 }
44 
45 }  // namespace net
46