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 EXPECT_EQ(map.size(), 4); |
61 //EXPECT_EQ(map.size(), 3); | |
62 | 65 |
63 entry = map.find(u"Foobar2"_str); | 66 entry = map.find(u"Foobar2"_str); |
64 EXPECT_FALSE(entry); | 67 EXPECT_FALSE(entry); |
65 | 68 |
66 int i = 0; | 69 int i = 0; |
67 for (const auto& e : map) | 70 for (const auto& e : map) |
68 { | 71 { |
69 EXPECT_FALSE(e.is_invalid()); | 72 EXPECT_FALSE(e.is_invalid()); |
70 // DISABLED entries that are deleted shouldn't be returned. | 73 // entries that are deleted shouldn't be returned. |
71 // See issue #6281 | 74 EXPECT_FALSE(e.is_deleted()); |
72 //EXPECT_FALSE(e.is_deleted()); | |
73 i++; | 75 i++; |
74 } | 76 } |
75 | 77 |
76 EXPECT_EQ(i, 4); // SHOULD be 3. See issue #6281 | 78 EXPECT_EQ(i, 3); |
77 EXPECT_EQ(i, map.size()); | 79 // We did not return deleted entries (there is one). |
| 80 // So size is different than actual count. |
| 81 EXPECT_NE(i, map.size()); |
78 } | 82 } |
79 | 83 |
80 TEST(TestStringMap, stringMap) | 84 TEST(TestStringMap, stringMap) |
81 { | 85 { |
82 testStringMap<StringMap>(); | 86 testStringMap<StringMap>(); |
83 } | 87 } |
84 | 88 |
85 TEST(TestStringMap, ownedStringMap) | 89 TEST(TestStringMap, ownedStringMap) |
86 { | 90 { |
87 testStringMap<OwnedStringMap>(); | 91 testStringMap<OwnedStringMap>(); |
88 } | 92 } |
OLD | NEW |