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, 3:02 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 //----------------------------------
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 {
26 std::wstring trimmed = TrimString( input );
27 ASSERT_EQ( expected, trimmed );
28 }
29 }
30
31 TEST( Trim, trim_00 )
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 {
33 TrimTest( L"", L"" );
34 }
35
36 TEST( Trim, trim_01 )
37 {
38 TrimTest( L" ", L"" );
39 }
40
41 TEST( Trim, trim_02 )
42 {
43 TrimTest( L"\n", L"" );
44 }
45
46 TEST( Trim, trim_03 )
47 {
48 TrimTest( L"\r", L"" );
49 }
50
51 TEST( Trim, trim_04 )
52 {
53 TrimTest( L"\t", L"" );
54 }
55
56 TEST( Trim, trim_05 )
57 {
58 TrimTest( L"foo", L"foo" );
59 }
60
61 TEST( Trim, trim_06 )
62 {
63 TrimTest( L" foo", L"foo" );
64 }
65
66 TEST( Trim, trim_07 )
67 {
68 TrimTest( L"\r\nfoo", L"foo" );
69 }
70
71 TEST( Trim, trim_08 )
72 {
73 TrimTest( L"\tfoo", L"foo" );
74 }
75
76 TEST( Trim, trim_09 )
77 {
78 TrimTest( L"foo ", L"foo" );
79 }
80
81 TEST( Trim, trim_10 )
82 {
83 TrimTest( L"foo\r\n", L"foo" );
84 }
85
86 TEST( Trim, trim_11 )
87 {
88 TrimTest( L"foo\t", L"foo" );
89 }
90
91 TEST( Trim, trim_12 )
92 {
93 TrimTest( L"foo bar", L"foo bar" );
94 }
95
96 TEST( Trim, trim_13 )
97 {
98 TrimTest( L"foo bar \r\n", L"foo bar" );
99 }
100
101 TEST( Trim, trim_14 )
102 {
103 TrimTest( L" foo bar \r\n", L"foo bar" );
104 }
105
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