OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 // It's not clear if we will ever use wchar_t strings on unix. In theory, | 28 // It's not clear if we will ever use wchar_t strings on unix. In theory, |
29 // all strings should be Utf8 all the time, except when interfacing with Win32 | 29 // all strings should be Utf8 all the time, except when interfacing with Win32 |
30 // APIs that require Utf16. | 30 // APIs that require Utf16. |
31 | 31 |
32 #if defined(WEBRTC_WIN) | 32 #if defined(WEBRTC_WIN) |
33 | 33 |
34 // Tests for ascii_string_compare(). | 34 // Tests for ascii_string_compare(). |
35 | 35 |
36 // Tests NULL input. | 36 // Tests null input. |
37 TEST(ascii_string_compareTest, NullInput) { | 37 TEST(ascii_string_compareTest, NullInput) { |
38 // The following results in an access violation in | 38 // The following results in an access violation in |
39 // ascii_string_compare. Is this a bug or by design? stringutils.h | 39 // ascii_string_compare. Is this a bug or by design? stringutils.h |
40 // should document the expected behavior in this case. | 40 // should document the expected behavior in this case. |
41 | 41 |
42 // EXPECT_EQ(0, ascii_string_compare(NULL, NULL, 1, identity)); | 42 // EXPECT_EQ(0, ascii_string_compare(nullptr, nullptr, 1, identity)); |
43 } | 43 } |
44 | 44 |
45 // Tests comparing two strings of different lengths. | 45 // Tests comparing two strings of different lengths. |
46 TEST(ascii_string_compareTest, DifferentLengths) { | 46 TEST(ascii_string_compareTest, DifferentLengths) { |
47 EXPECT_EQ(-1, ascii_string_compare(L"Test", "Test1", 5, identity)); | 47 EXPECT_EQ(-1, ascii_string_compare(L"Test", "Test1", 5, identity)); |
48 } | 48 } |
49 | 49 |
50 // Tests the case where the buffer size is smaller than the string | 50 // Tests the case where the buffer size is smaller than the string |
51 // lengths. | 51 // lengths. |
52 TEST(ascii_string_compareTest, SmallBuffer) { | 52 TEST(ascii_string_compareTest, SmallBuffer) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 EXPECT_TRUE(ends_with("foobar", "bar")); | 99 EXPECT_TRUE(ends_with("foobar", "bar")); |
100 EXPECT_TRUE(ends_with("foobar", "foobar")); | 100 EXPECT_TRUE(ends_with("foobar", "foobar")); |
101 EXPECT_TRUE(ends_with("foobar", "")); | 101 EXPECT_TRUE(ends_with("foobar", "")); |
102 EXPECT_TRUE(ends_with("", "")); | 102 EXPECT_TRUE(ends_with("", "")); |
103 EXPECT_FALSE(ends_with("foobar", "foo")); | 103 EXPECT_FALSE(ends_with("foobar", "foo")); |
104 EXPECT_FALSE(ends_with("foobar", "foobarbaz")); | 104 EXPECT_FALSE(ends_with("foobar", "foobarbaz")); |
105 EXPECT_FALSE(ends_with("", "f")); | 105 EXPECT_FALSE(ends_with("", "f")); |
106 } | 106 } |
107 | 107 |
108 } // namespace rtc | 108 } // namespace rtc |
OLD | NEW |