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

Unified Diff: test/compiled/StringMap.cpp

Issue 29695640: Issue 6281 - Don't return deleted entries (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Removed unused comment. Created Feb. 13, 2018, 2:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled/Map.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/compiled/StringMap.cpp
===================================================================
--- a/test/compiled/StringMap.cpp
+++ b/test/compiled/StringMap.cpp
@@ -40,46 +40,50 @@
EXPECT_EQ(map.size(), 2);
auto entry = map.find(u"Foobar"_str);
EXPECT_TRUE(entry);
entry = map.find(u"Foobar2"_str);
EXPECT_FALSE(entry);
- map[u"Foobar2"_str] = "two";
+rr map[u"Foobar2"_str] = "two";
sergei 2018/02/13 15:01:39 could you please also remove it? :)
hub 2018/02/13 15:08:44 *sigh*. how did that slide in. Done
entry = map.find(u"Foobar2"_str);
EXPECT_TRUE(entry);
map[u"Foobar3"_str] = "three";
entry = map.find(u"Foobar3"_str);
EXPECT_TRUE(entry);
EXPECT_EQ(map.size(), 4);
- map.erase(u"Foobar2"_str);
+ EXPECT_TRUE(map.erase(u"Foobar2"_str));
+ // already deleted. Returns false.
+ EXPECT_FALSE(map.erase(u"Foobar2"_str));
+ // invalid. Returns false.
+ EXPECT_FALSE(map.erase(u"Foobar42"_str));
- // DISABLED. This should be true, but it isn't
- //EXPECT_EQ(map.size(), 3);
+ EXPECT_EQ(map.size(), 4);
entry = map.find(u"Foobar2"_str);
EXPECT_FALSE(entry);
int i = 0;
for (const auto& e : map)
{
EXPECT_FALSE(e.is_invalid());
- // DISABLED entries that are deleted shouldn't be returned.
- // See issue #6281
- //EXPECT_FALSE(e.is_deleted());
+ // entries that are deleted shouldn't be returned.
+ EXPECT_FALSE(e.is_deleted());
i++;
}
- EXPECT_EQ(i, 4); // SHOULD be 3. See issue #6281
- EXPECT_EQ(i, map.size());
+ EXPECT_EQ(i, 3);
+ // We did not return deleted entries (there is one).
+ // So size is different than actual count.
+ EXPECT_NE(i, map.size());
}
TEST(TestStringMap, stringMap)
{
testStringMap<StringMap>();
}
TEST(TestStringMap, ownedStringMap)
« no previous file with comments | « compiled/Map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld