Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"barfoo")); | 72 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"barfoo")); |
73 } | 73 } |
74 | 74 |
75 TEST(ToLowerString, Empty) | 75 TEST(ToLowerString, Empty) |
76 { | 76 { |
77 ASSERT_EQ(L"", ToLowerString(L"")); | 77 ASSERT_EQ(L"", ToLowerString(L"")); |
78 } | 78 } |
79 | 79 |
80 TEST(ToLowerString, NotEmpty) | 80 TEST(ToLowerString, NotEmpty) |
81 { | 81 { |
82 ASSERT_EQ(L"foo", ToLowerString(L"Foo")); | 82 ASSERT_EQ(L"foobar", ToLowerString(L"FooBAR")); |
83 } | 83 } |
84 | 84 |
85 TEST(ToLowerString, NullWithExtra) | 85 TEST(ToLowerString, NullWithExtra) |
86 { | 86 { |
87 std::wstring input(L"\0BAR", 4); | 87 std::wstring input(L"\0BAR", 4); |
88 ASSERT_EQ(4, input.length()); | 88 ASSERT_EQ(4, input.length()); |
89 | 89 |
90 std::wstring actual; | 90 std::wstring actual; |
91 ASSERT_NO_THROW({ actual = ToLowerString(input); }); | 91 ASSERT_NO_THROW({ actual = ToLowerString(input); }); |
92 // White-box tests for further verification of no-crash behavior | 92 // White-box tests for further verification of no-crash behavior |
93 ASSERT_EQ(4, actual.length()); | 93 ASSERT_EQ(4, actual.length()); |
94 ASSERT_EQ(L"", std::wstring(actual.c_str())); | 94 ASSERT_EQ(L"", std::wstring(actual.c_str())); |
sergei
2015/12/16 15:53:16
That looks strange, it's good to know what happene
Eric
2015/12/16 16:38:07
Don't need to know. The (new) specification for th
| |
95 } | 95 } |
96 | 96 |
97 TEST(ToLowerString, InternalNull) | 97 TEST(ToLowerString, InternalNull) |
98 { | 98 { |
99 std::wstring input(L"Foo\0BAR", 7); | 99 std::wstring input(L"Foo\0BAR", 7); |
100 ASSERT_EQ(7, input.length()); | 100 ASSERT_EQ(7, input.length()); |
101 | 101 |
102 std::wstring actual; | 102 std::wstring actual; |
103 ASSERT_NO_THROW({ actual = ToLowerString(input); }); | 103 ASSERT_NO_THROW({ actual = ToLowerString(input); }); |
104 // White-box tests for further verification of no-crash behavior | 104 // White-box tests for further verification of no-crash behavior |
105 ASSERT_EQ(7, actual.length()); | 105 ASSERT_EQ(7, actual.length()); |
106 ASSERT_EQ(L"foo", std::wstring(actual.c_str())); | 106 ASSERT_EQ(L"foo", std::wstring(actual.c_str())); |
107 } | 107 } |
LEFT | RIGHT |