Left: | ||
Right: |
OLD | NEW |
---|---|
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); |
34 EXPECT_EQ(map.begin(), map.end()); | |
sergei
2018/02/12 08:50:05
It seems this line is redundant because `map` is n
hub
2018/02/12 14:20:25
Done.
| |
31 | 35 |
32 map[u"Foobar"_str] = "one"; | 36 map[u"Foobar"_str] = "one"; |
33 EXPECT_EQ(map.size(), 1); | 37 EXPECT_EQ(map.size(), 1); |
38 EXPECT_NE(map.begin(), map.end()); | |
sergei
2018/02/12 08:50:05
That's all right. In addition it would be good to
sergei
2018/02/12 08:54:28
I missed the comment in the issue description, see
| |
34 | 39 |
35 map[u""_str] = "null"; | 40 map[u""_str] = "null"; |
36 EXPECT_EQ(map.size(), 2); | 41 EXPECT_EQ(map.size(), 2); |
37 | 42 |
38 auto entry = map.find(u"Foobar"_str); | 43 auto entry = map.find(u"Foobar"_str); |
39 EXPECT_TRUE(entry); | 44 EXPECT_TRUE(entry); |
40 | 45 |
41 entry = map.find(u"Foobar2"_str); | 46 entry = map.find(u"Foobar2"_str); |
42 EXPECT_FALSE(entry); | 47 EXPECT_FALSE(entry); |
43 | 48 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 80 |
76 TEST(TestStringMap, stringMap) | 81 TEST(TestStringMap, stringMap) |
77 { | 82 { |
78 testStringMap<StringMap>(); | 83 testStringMap<StringMap>(); |
79 } | 84 } |
80 | 85 |
81 TEST(TestStringMap, ownedStringMap) | 86 TEST(TestStringMap, ownedStringMap) |
82 { | 87 { |
83 testStringMap<OwnedStringMap>(); | 88 testStringMap<OwnedStringMap>(); |
84 } | 89 } |
OLD | NEW |