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

Side by Side Diff: test/compiled/StringMap.cpp

Issue 29692574: Issue 6280 - Check that we don't return invalid entries (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Removed duplicate test. Created Feb. 12, 2018, 2:20 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 | « no previous file | 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
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 <string> 18 #include <string>
19 #include "gtest/gtest.h" 19 #include "gtest/gtest.h"
20 #include "compiled/StringMap.h" 20 #include "compiled/StringMap.h"
21 21
22 ABP_NS_USING 22 ABP_NS_USING
23 23
24 template<template <typename T> class S> 24 template<template <typename T> class S>
25 void testStringMap() 25 void testStringMap()
26 { 26 {
27 S<std::string> map; 27 S<std::string> map;
28
29 EXPECT_EQ(map.begin(), map.end());
30
28 auto key = u"Foobar"_str; 31 auto key = u"Foobar"_str;
29 EXPECT_EQ(key.length(), 6); 32 EXPECT_EQ(key.length(), 6);
30 EXPECT_EQ(map.size(), 0); 33 EXPECT_EQ(map.size(), 0);
31 34
32 map[u"Foobar"_str] = "one"; 35 map[u"Foobar"_str] = "one";
33 EXPECT_EQ(map.size(), 1); 36 EXPECT_EQ(map.size(), 1);
37 EXPECT_NE(map.begin(), map.end());
34 38
35 map[u""_str] = "null"; 39 map[u""_str] = "null";
36 EXPECT_EQ(map.size(), 2); 40 EXPECT_EQ(map.size(), 2);
37 41
38 auto entry = map.find(u"Foobar"_str); 42 auto entry = map.find(u"Foobar"_str);
39 EXPECT_TRUE(entry); 43 EXPECT_TRUE(entry);
40 44
41 entry = map.find(u"Foobar2"_str); 45 entry = map.find(u"Foobar2"_str);
42 EXPECT_FALSE(entry); 46 EXPECT_FALSE(entry);
43 47
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 79
76 TEST(TestStringMap, stringMap) 80 TEST(TestStringMap, stringMap)
77 { 81 {
78 testStringMap<StringMap>(); 82 testStringMap<StringMap>();
79 } 83 }
80 84
81 TEST(TestStringMap, ownedStringMap) 85 TEST(TestStringMap, ownedStringMap)
82 { 86 {
83 testStringMap<OwnedStringMap>(); 87 testStringMap<OwnedStringMap>();
84 } 88 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld