Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/UtilTest.cpp

Issue 4628980216889344: Issue #1234 - Add unit tests for TrimString (Closed)
Left Patch Set: Created Jan. 5, 2015, 4:24 p.m.
Right Patch Set: Created Jan. 14, 2015, 1:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « adblockplus.gyp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 //----------------------------------
21 // Trim
22 //----------------------------------
23 namespace 20 namespace
24 { 21 {
25 void TrimTest(std::wstring input, std::wstring expected) 22 void TrimTestBody(std::wstring input, std::wstring expected)
26 { 23 {
27 std::wstring trimmed = TrimString(input); 24 std::wstring trimmed = TrimString(input);
28 ASSERT_EQ(expected, trimmed); 25 ASSERT_EQ(expected, trimmed);
29 } 26 }
30 } 27 }
31 28
32 TEST(Trim, trim_00) 29 TEST(TrimTest, Trim00)
sergei 2015/01/05 16:51:03 We also usually add "Test" to the test case, thus
Eric 2015/01/05 17:18:25 We have, and it's entirely redundant to do so. It'
sergei 2015/01/05 21:13:53 Consistency
Oleksandr 2015/01/09 00:16:59 I agree with Sergei. Also, TEST(TrimTest, Trim00)
33 { 30 {
34 TrimTest(L"", L""); 31 TrimTestBody(L"", L"");
35 } 32 }
36 33
37 TEST(Trim, trim_01) 34 TEST(TrimTest, Trim01)
38 { 35 {
39 TrimTest(L" ", L""); 36 TrimTestBody(L" ", L"");
40 } 37 }
41 38
42 TEST(Trim, trim_02) 39 TEST(TrimTest, Trim02)
43 { 40 {
44 TrimTest(L"\n", L""); 41 TrimTestBody(L"\n", L"");
45 } 42 }
46 43
47 TEST(Trim, trim_03) 44 TEST(TrimTest, Trim03)
48 { 45 {
49 TrimTest(L"\r", L""); 46 TrimTestBody(L"\r", L"");
50 } 47 }
51 48
52 TEST(Trim, trim_04) 49 TEST(TrimTest, Trim04)
53 { 50 {
54 TrimTest(L"\t", L""); 51 TrimTestBody(L"\t", L"");
55 } 52 }
56 53
57 TEST(Trim, trim_05) 54 TEST(TrimTest, Trim05)
58 { 55 {
59 TrimTest(L"foo", L"foo"); 56 TrimTestBody(L"foo", L"foo");
60 } 57 }
61 58
62 TEST(Trim, trim_06) 59 TEST(TrimTest, Trim06)
63 { 60 {
64 TrimTest(L" foo", L"foo"); 61 TrimTestBody(L" foo", L"foo");
65 } 62 }
66 63
67 TEST(Trim, trim_07) 64 TEST(TrimTest, Trim07)
68 { 65 {
69 TrimTest(L"\r\nfoo", L"foo"); 66 TrimTestBody(L"\r\nfoo", L"foo");
70 } 67 }
71 68
72 TEST(Trim, trim_08) 69 TEST(TrimTest, Trim08)
73 { 70 {
74 TrimTest(L"\tfoo", L"foo"); 71 TrimTestBody(L"\tfoo", L"foo");
75 } 72 }
76 73
77 TEST(Trim, trim_09) 74 TEST(TrimTest, Trim09)
78 { 75 {
79 TrimTest(L"foo ", L"foo"); 76 TrimTestBody(L"foo ", L"foo");
80 } 77 }
81 78
82 TEST(Trim, trim_10) 79 TEST(TrimTest, Trim10)
83 { 80 {
84 TrimTest(L"foo\r\n", L"foo"); 81 TrimTestBody(L"foo\r\n", L"foo");
85 } 82 }
86 83
87 TEST(Trim, trim_11) 84 TEST(TrimTest, Trim11)
88 { 85 {
89 TrimTest(L"foo\t", L"foo"); 86 TrimTestBody(L"foo\t", L"foo");
90 } 87 }
91 88
92 TEST(Trim, trim_12) 89 TEST(TrimTest, Trim12)
93 { 90 {
94 TrimTest(L"foo bar", L"foo bar"); 91 TrimTestBody(L"foo bar", L"foo bar");
95 } 92 }
96 93
97 TEST(Trim, trim_13) 94 TEST(TrimTest, Trim13)
98 { 95 {
99 TrimTest(L"foo bar \r\n", L"foo bar"); 96 TrimTestBody(L"foo bar \r\n", L"foo bar");
100 } 97 }
101 98
102 TEST(Trim, trim_14) 99 TEST(TrimTest, Trim14)
103 { 100 {
104 TrimTest(L" foo bar \r\n", L"foo bar"); 101 TrimTestBody(L" foo bar \r\n", L"foo bar");
105 } 102 }
106
LEFTRIGHT

Powered by Google App Engine
This is Rietveld