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