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. 14, 2015, 1:46 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 namespace
21 {
22 void TrimTestBody(std::wstring input, std::wstring expected)
23 {
24 std::wstring trimmed = TrimString(input);
25 ASSERT_EQ(expected, trimmed);
26 }
27 }
28
29 TEST(TrimTest, Trim00)
30 {
31 TrimTestBody(L"", L"");
32 }
33
34 TEST(TrimTest, Trim01)
35 {
36 TrimTestBody(L" ", L"");
37 }
38
39 TEST(TrimTest, Trim02)
40 {
41 TrimTestBody(L"\n", L"");
42 }
43
44 TEST(TrimTest, Trim03)
45 {
46 TrimTestBody(L"\r", L"");
47 }
48
49 TEST(TrimTest, Trim04)
50 {
51 TrimTestBody(L"\t", L"");
52 }
53
54 TEST(TrimTest, Trim05)
55 {
56 TrimTestBody(L"foo", L"foo");
57 }
58
59 TEST(TrimTest, Trim06)
60 {
61 TrimTestBody(L" foo", L"foo");
62 }
63
64 TEST(TrimTest, Trim07)
65 {
66 TrimTestBody(L"\r\nfoo", L"foo");
67 }
68
69 TEST(TrimTest, Trim08)
70 {
71 TrimTestBody(L"\tfoo", L"foo");
72 }
73
74 TEST(TrimTest, Trim09)
75 {
76 TrimTestBody(L"foo ", L"foo");
77 }
78
79 TEST(TrimTest, Trim10)
80 {
81 TrimTestBody(L"foo\r\n", L"foo");
82 }
83
84 TEST(TrimTest, Trim11)
85 {
86 TrimTestBody(L"foo\t", L"foo");
87 }
88
89 TEST(TrimTest, Trim12)
90 {
91 TrimTestBody(L"foo bar", L"foo bar");
92 }
93
94 TEST(TrimTest, Trim13)
95 {
96 TrimTestBody(L"foo bar \r\n", L"foo bar");
97 }
98
99 TEST(TrimTest, Trim14)
100 {
101 TrimTestBody(L" foo bar \r\n", L"foo bar");
102 }
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