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

Side by Side Diff: test/UtilTest.cpp

Issue 4628980216889344: Issue #1234 - Add unit tests for TrimString (Closed)
Patch Set: Created Jan. 5, 2015, 4:24 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « adblockplus.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17 #include <gtest/gtest.h>
18 #include "../src/shared/Utils.h"
19
20 //----------------------------------
21 // Trim
22 //----------------------------------
23 namespace
24 {
25 void TrimTest(std::wstring input, std::wstring expected)
26 {
27 std::wstring trimmed = TrimString(input);
28 ASSERT_EQ(expected, trimmed);
29 }
30 }
31
32 TEST(Trim, trim_00)
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 {
34 TrimTest(L"", L"");
35 }
36
37 TEST(Trim, trim_01)
38 {
39 TrimTest(L" ", L"");
40 }
41
42 TEST(Trim, trim_02)
43 {
44 TrimTest(L"\n", L"");
45 }
46
47 TEST(Trim, trim_03)
48 {
49 TrimTest(L"\r", L"");
50 }
51
52 TEST(Trim, trim_04)
53 {
54 TrimTest(L"\t", L"");
55 }
56
57 TEST(Trim, trim_05)
58 {
59 TrimTest(L"foo", L"foo");
60 }
61
62 TEST(Trim, trim_06)
63 {
64 TrimTest(L" foo", L"foo");
65 }
66
67 TEST(Trim, trim_07)
68 {
69 TrimTest(L"\r\nfoo", L"foo");
70 }
71
72 TEST(Trim, trim_08)
73 {
74 TrimTest(L"\tfoo", L"foo");
75 }
76
77 TEST(Trim, trim_09)
78 {
79 TrimTest(L"foo ", L"foo");
80 }
81
82 TEST(Trim, trim_10)
83 {
84 TrimTest(L"foo\r\n", L"foo");
85 }
86
87 TEST(Trim, trim_11)
88 {
89 TrimTest(L"foo\t", L"foo");
90 }
91
92 TEST(Trim, trim_12)
93 {
94 TrimTest(L"foo bar", L"foo bar");
95 }
96
97 TEST(Trim, trim_13)
98 {
99 TrimTest(L"foo bar \r\n", L"foo bar");
100 }
101
102 TEST(Trim, trim_14)
103 {
104 TrimTest(L" foo bar \r\n", L"foo bar");
105 }
106
OLDNEW
« no previous file with comments | « adblockplus.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld