Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 #include <gtest/gtest.h> | 17 #include <gtest/gtest.h> |
18 #include "../src/shared/Utils.h" | 18 #include "../src/shared/Utils.h" |
19 | 19 |
20 //---------------------------------- | 20 namespace |
21 // Trim | 21 { |
22 //---------------------------------- | 22 void TrimTestBody(std::wstring input, std::wstring expected) |
sergei
2015/01/05 15:27:43
I would say we don't need these comments
Eric
2015/01/05 16:25:07
We'll need these once the other unit tests land in
sergei
2015/01/05 16:51:03
Why will we need it? We don't use them in other fi
Eric
2015/01/05 17:18:25
I've got around another 70 tests already written (
sergei
2015/01/05 21:13:53
It still does not convince me, let's wait for @Ole
Oleksandr
2015/01/09 00:16:59
If we add 70 more tests in this file it will be ha
| |
23 namespace { | |
sergei
2015/01/05 15:27:43
{ should be on the new line
Eric
2015/01/05 16:25:07
Done.
| |
24 void TrimTest( std::wstring input, std::wstring expected ) | |
25 { | 23 { |
26 std::wstring trimmed = TrimString( input ); | 24 std::wstring trimmed = TrimString(input); |
27 ASSERT_EQ( expected, trimmed ); | 25 ASSERT_EQ(expected, trimmed); |
28 } | 26 } |
29 } | 27 } |
30 | 28 |
31 TEST( Trim, trim_00 ) | 29 TEST(TrimTest, Trim00) |
sergei
2015/01/05 15:27:43
here, above and below: we don't use spaces after (
Eric
2015/01/05 16:25:07
Done.
| |
32 { | 30 { |
33 TrimTest( L"", L"" ); | 31 TrimTestBody(L"", L""); |
34 } | 32 } |
35 | 33 |
36 TEST( Trim, trim_01 ) | 34 TEST(TrimTest, Trim01) |
37 { | 35 { |
38 TrimTest( L" ", L"" ); | 36 TrimTestBody(L" ", L""); |
39 } | 37 } |
40 | 38 |
41 TEST( Trim, trim_02 ) | 39 TEST(TrimTest, Trim02) |
42 { | 40 { |
43 TrimTest( L"\n", L"" ); | 41 TrimTestBody(L"\n", L""); |
44 } | 42 } |
45 | 43 |
46 TEST( Trim, trim_03 ) | 44 TEST(TrimTest, Trim03) |
47 { | 45 { |
48 TrimTest( L"\r", L"" ); | 46 TrimTestBody(L"\r", L""); |
49 } | 47 } |
50 | 48 |
51 TEST( Trim, trim_04 ) | 49 TEST(TrimTest, Trim04) |
52 { | 50 { |
53 TrimTest( L"\t", L"" ); | 51 TrimTestBody(L"\t", L""); |
54 } | 52 } |
55 | 53 |
56 TEST( Trim, trim_05 ) | 54 TEST(TrimTest, Trim05) |
57 { | 55 { |
58 TrimTest( L"foo", L"foo" ); | 56 TrimTestBody(L"foo", L"foo"); |
59 } | 57 } |
60 | 58 |
61 TEST( Trim, trim_06 ) | 59 TEST(TrimTest, Trim06) |
62 { | 60 { |
63 TrimTest( L" foo", L"foo" ); | 61 TrimTestBody(L" foo", L"foo"); |
64 } | 62 } |
65 | 63 |
66 TEST( Trim, trim_07 ) | 64 TEST(TrimTest, Trim07) |
67 { | 65 { |
68 TrimTest( L"\r\nfoo", L"foo" ); | 66 TrimTestBody(L"\r\nfoo", L"foo"); |
69 } | 67 } |
70 | 68 |
71 TEST( Trim, trim_08 ) | 69 TEST(TrimTest, Trim08) |
72 { | 70 { |
73 TrimTest( L"\tfoo", L"foo" ); | 71 TrimTestBody(L"\tfoo", L"foo"); |
74 } | 72 } |
75 | 73 |
76 TEST( Trim, trim_09 ) | 74 TEST(TrimTest, Trim09) |
77 { | 75 { |
78 TrimTest( L"foo ", L"foo" ); | 76 TrimTestBody(L"foo ", L"foo"); |
79 } | 77 } |
80 | 78 |
81 TEST( Trim, trim_10 ) | 79 TEST(TrimTest, Trim10) |
82 { | 80 { |
83 TrimTest( L"foo\r\n", L"foo" ); | 81 TrimTestBody(L"foo\r\n", L"foo"); |
84 } | 82 } |
85 | 83 |
86 TEST( Trim, trim_11 ) | 84 TEST(TrimTest, Trim11) |
87 { | 85 { |
88 TrimTest( L"foo\t", L"foo" ); | 86 TrimTestBody(L"foo\t", L"foo"); |
89 } | 87 } |
90 | 88 |
91 TEST( Trim, trim_12 ) | 89 TEST(TrimTest, Trim12) |
92 { | 90 { |
93 TrimTest( L"foo bar", L"foo bar" ); | 91 TrimTestBody(L"foo bar", L"foo bar"); |
94 } | 92 } |
95 | 93 |
96 TEST( Trim, trim_13 ) | 94 TEST(TrimTest, Trim13) |
97 { | 95 { |
98 TrimTest( L"foo bar \r\n", L"foo bar" ); | 96 TrimTestBody(L"foo bar \r\n", L"foo bar"); |
99 } | 97 } |
100 | 98 |
101 TEST( Trim, trim_14 ) | 99 TEST(TrimTest, Trim14) |
102 { | 100 { |
103 TrimTest( L" foo bar \r\n", L"foo bar" ); | 101 TrimTestBody(L" foo bar \r\n", L"foo bar"); |
104 } | 102 } |
105 | |
LEFT | RIGHT |