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

Side by Side Diff: test/ReferrerMapping.cpp

Issue 29391770: Noissue - Fix sign comparison warnings in tests. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created March 22, 2017, 3:32 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 | « test/Notification.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 17
18 #include <AdblockPlus.h> 18 #include <AdblockPlus.h>
19 #include <gtest/gtest.h> 19 #include <gtest/gtest.h>
20 20
21 TEST(ReferrerMappingTest, EmptyReferrerChain) 21 TEST(ReferrerMappingTest, EmptyReferrerChain)
22 { 22 {
23 AdblockPlus::ReferrerMapping referrerMapping; 23 AdblockPlus::ReferrerMapping referrerMapping;
24 std::vector<std::string> referrerChain = 24 std::vector<std::string> referrerChain =
25 referrerMapping.BuildReferrerChain("first"); 25 referrerMapping.BuildReferrerChain("first");
26 ASSERT_EQ(1, referrerChain.size()); 26 ASSERT_EQ(1u, referrerChain.size());
27 ASSERT_EQ("first", referrerChain[0]); 27 ASSERT_EQ("first", referrerChain[0]);
28 } 28 }
29 29
30 TEST(ReferrerMappingTest, TwoElementReferrerChain) 30 TEST(ReferrerMappingTest, TwoElementReferrerChain)
31 { 31 {
32 AdblockPlus::ReferrerMapping referrerMapping; 32 AdblockPlus::ReferrerMapping referrerMapping;
33 referrerMapping.Add("second", "first"); 33 referrerMapping.Add("second", "first");
34 std::vector<std::string> referrerChain = 34 std::vector<std::string> referrerChain =
35 referrerMapping.BuildReferrerChain("second"); 35 referrerMapping.BuildReferrerChain("second");
36 ASSERT_EQ(2, referrerChain.size()); 36 ASSERT_EQ(2u, referrerChain.size());
37 ASSERT_EQ("first", referrerChain[0]); 37 ASSERT_EQ("first", referrerChain[0]);
38 ASSERT_EQ("second", referrerChain[1]); 38 ASSERT_EQ("second", referrerChain[1]);
39 } 39 }
40 40
41 TEST(ReferrerMappingTest, TenElementReferrerChain) 41 TEST(ReferrerMappingTest, TenElementReferrerChain)
42 { 42 {
43 AdblockPlus::ReferrerMapping referrerMapping; 43 AdblockPlus::ReferrerMapping referrerMapping;
44 referrerMapping.Add("second", "first"); 44 referrerMapping.Add("second", "first");
45 referrerMapping.Add("third", "second"); 45 referrerMapping.Add("third", "second");
46 referrerMapping.Add("fourth", "third"); 46 referrerMapping.Add("fourth", "third");
47 referrerMapping.Add("fifth", "fourth"); 47 referrerMapping.Add("fifth", "fourth");
48 referrerMapping.Add("sixth", "fifth"); 48 referrerMapping.Add("sixth", "fifth");
49 referrerMapping.Add("seventh", "sixth"); 49 referrerMapping.Add("seventh", "sixth");
50 referrerMapping.Add("eighth", "seventh"); 50 referrerMapping.Add("eighth", "seventh");
51 referrerMapping.Add("ninth", "eighth"); 51 referrerMapping.Add("ninth", "eighth");
52 referrerMapping.Add("tenth", "ninth"); 52 referrerMapping.Add("tenth", "ninth");
53 std::vector<std::string> referrerChain = 53 std::vector<std::string> referrerChain =
54 referrerMapping.BuildReferrerChain("tenth"); 54 referrerMapping.BuildReferrerChain("tenth");
55 ASSERT_EQ(10, referrerChain.size()); 55 ASSERT_EQ(10u, referrerChain.size());
56 ASSERT_EQ("first", referrerChain[0]); 56 ASSERT_EQ("first", referrerChain[0]);
57 ASSERT_EQ("second", referrerChain[1]); 57 ASSERT_EQ("second", referrerChain[1]);
58 ASSERT_EQ("third", referrerChain[2]); 58 ASSERT_EQ("third", referrerChain[2]);
59 ASSERT_EQ("fourth", referrerChain[3]); 59 ASSERT_EQ("fourth", referrerChain[3]);
60 ASSERT_EQ("fifth", referrerChain[4]); 60 ASSERT_EQ("fifth", referrerChain[4]);
61 ASSERT_EQ("sixth", referrerChain[5]); 61 ASSERT_EQ("sixth", referrerChain[5]);
62 ASSERT_EQ("seventh", referrerChain[6]); 62 ASSERT_EQ("seventh", referrerChain[6]);
63 ASSERT_EQ("eighth", referrerChain[7]); 63 ASSERT_EQ("eighth", referrerChain[7]);
64 ASSERT_EQ("ninth", referrerChain[8]); 64 ASSERT_EQ("ninth", referrerChain[8]);
65 ASSERT_EQ("tenth", referrerChain[9]); 65 ASSERT_EQ("tenth", referrerChain[9]);
66 } 66 }
67 67
68 TEST(ReferrerMappingTest, CacheOnlyFiveUrls) 68 TEST(ReferrerMappingTest, CacheOnlyFiveUrls)
69 { 69 {
70 AdblockPlus::ReferrerMapping referrerMapping(5); 70 AdblockPlus::ReferrerMapping referrerMapping(5);
71 referrerMapping.Add("second", "first"); 71 referrerMapping.Add("second", "first");
72 referrerMapping.Add("third", "second"); 72 referrerMapping.Add("third", "second");
73 referrerMapping.Add("fourth", "third"); 73 referrerMapping.Add("fourth", "third");
74 referrerMapping.Add("fifth", "fourth"); 74 referrerMapping.Add("fifth", "fourth");
75 referrerMapping.Add("sixth", "fifth"); 75 referrerMapping.Add("sixth", "fifth");
76 referrerMapping.Add("seventh", "sixth"); 76 referrerMapping.Add("seventh", "sixth");
77 std::vector<std::string> referrerChain = 77 std::vector<std::string> referrerChain =
78 referrerMapping.BuildReferrerChain("seventh"); 78 referrerMapping.BuildReferrerChain("seventh");
79 ASSERT_EQ(6, referrerChain.size()); 79 ASSERT_EQ(6u, referrerChain.size());
80 ASSERT_EQ("second", referrerChain[0]); 80 ASSERT_EQ("second", referrerChain[0]);
81 ASSERT_EQ("third", referrerChain[1]); 81 ASSERT_EQ("third", referrerChain[1]);
82 ASSERT_EQ("fourth", referrerChain[2]); 82 ASSERT_EQ("fourth", referrerChain[2]);
83 ASSERT_EQ("fifth", referrerChain[3]); 83 ASSERT_EQ("fifth", referrerChain[3]);
84 ASSERT_EQ("sixth", referrerChain[4]); 84 ASSERT_EQ("sixth", referrerChain[4]);
85 ASSERT_EQ("seventh", referrerChain[5]); 85 ASSERT_EQ("seventh", referrerChain[5]);
86 } 86 }
OLDNEW
« no previous file with comments | « test/Notification.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld