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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 map[u"Foobar2"_str] = "two"; | 48 map[u"Foobar2"_str] = "two"; |
49 entry = map.find(u"Foobar2"_str); | 49 entry = map.find(u"Foobar2"_str); |
50 EXPECT_TRUE(entry); | 50 EXPECT_TRUE(entry); |
51 | 51 |
52 map[u"Foobar3"_str] = "three"; | 52 map[u"Foobar3"_str] = "three"; |
53 entry = map.find(u"Foobar3"_str); | 53 entry = map.find(u"Foobar3"_str); |
54 EXPECT_TRUE(entry); | 54 EXPECT_TRUE(entry); |
55 | 55 |
56 EXPECT_EQ(map.size(), 4); | 56 EXPECT_EQ(map.size(), 4); |
57 | 57 |
58 map.erase(u"Foobar2"_str); | 58 EXPECT_TRUE(map.erase(u"Foobar2"_str)); |
59 // already deleted. Returns false. | |
60 EXPECT_FALSE(map.erase(u"Foobar2"_str)); | |
61 // invalid. Returns false. | |
62 EXPECT_FALSE(map.erase(u"Foobar42"_str)); | |
59 | 63 |
60 // DISABLED. This should be true, but it isn't | 64 // XXX should be 4. |
sergei
2018/02/13 09:06:39
it seems this comment is not finished.
hub
2018/02/13 14:46:29
Removed now.
| |
61 //EXPECT_EQ(map.size(), 3); | 65 EXPECT_EQ(map.size(), 4); |
62 | 66 |
63 entry = map.find(u"Foobar2"_str); | 67 entry = map.find(u"Foobar2"_str); |
64 EXPECT_FALSE(entry); | 68 EXPECT_FALSE(entry); |
65 | 69 |
66 int i = 0; | 70 int i = 0; |
67 for (const auto& e : map) | 71 for (const auto& e : map) |
68 { | 72 { |
69 EXPECT_FALSE(e.is_invalid()); | 73 EXPECT_FALSE(e.is_invalid()); |
70 // DISABLED entries that are deleted shouldn't be returned. | 74 // entries that are deleted shouldn't be returned. |
71 // See issue #6281 | 75 EXPECT_FALSE(e.is_deleted()); |
72 //EXPECT_FALSE(e.is_deleted()); | |
73 i++; | 76 i++; |
74 } | 77 } |
75 | 78 |
76 EXPECT_EQ(i, 4); // SHOULD be 3. See issue #6281 | 79 EXPECT_EQ(i, 3); |
77 EXPECT_EQ(i, map.size()); | 80 // We did not return deleted entries (there is one). |
81 // So size is different than actual count. | |
82 EXPECT_NE(i, map.size()); | |
78 } | 83 } |
79 | 84 |
80 TEST(TestStringMap, stringMap) | 85 TEST(TestStringMap, stringMap) |
81 { | 86 { |
82 testStringMap<StringMap>(); | 87 testStringMap<StringMap>(); |
83 } | 88 } |
84 | 89 |
85 TEST(TestStringMap, ownedStringMap) | 90 TEST(TestStringMap, ownedStringMap) |
86 { | 91 { |
87 testStringMap<OwnedStringMap>(); | 92 testStringMap<OwnedStringMap>(); |
88 } | 93 } |
OLD | NEW |