Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Unified Diff: runtime/bin/hashmap_test.cc

Issue 2542103002: VM: Remove unused (and incomplete) HashMap::Remove() function (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/platform/hashmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/hashmap_test.cc
diff --git a/runtime/bin/hashmap_test.cc b/runtime/bin/hashmap_test.cc
index 0a4ee31ed104d47545cc960b011d6ebfc31f404f..bad384b79a339d056e50435dc45e1b1468a74614 100644
--- a/runtime/bin/hashmap_test.cc
+++ b/runtime/bin/hashmap_test.cc
@@ -180,47 +180,4 @@ UNIT_TEST_CASE(HashMap_Basic) {
TestSet(CollisionHash4, 50);
}
-
-UNIT_TEST_CASE(HashMap_RemoveDuringIteration) {
- class Utils {
- public:
- static bool MatchFun(void* key1, void* key2) { return key1 == key2; }
- static void* Key(intptr_t i) { return reinterpret_cast<void*>(i); }
- static void* Value(intptr_t i) { return reinterpret_cast<void*>(i); }
- static uint32_t HashCode(intptr_t key) { return 1; }
- };
-
- HashMap map(Utils::MatchFun, 8);
-
- // Add 6 (1, 1), ..., (6, 60) entries to the map all with a hashcode of 1
- // (i.e. have all keys have collinding hashcode).
- //
- // This causes the probing position in the hashmap to be 1 and open-addressing
- // with linear probing will fill in the slots towards the right
- // (i.e. from 1..6).
- for (intptr_t i = 1; i <= 6 /* avoid rehash at 7 */; i++) {
- HashMap::Entry* entry = map.Lookup(Utils::Key(i), Utils::HashCode(i), true);
- entry->value = Utils::Value(10 * i);
- }
-
- // Now we iterate over all elements and delete the current element. Since all
- // our entries have a colliding hashcode of 1, each deletion will cause all
- // following elements to be left-rotated by 1.
- intptr_t i = 0;
- HashMap::Entry* current = map.Start();
- while (current != NULL) {
- i++;
- EXPECT_EQ(Utils::Key(i), current->key);
- EXPECT_EQ(Utils::Value(10 * i), current->value);
-
- // Every 2nd element we keep to hit the left-rotation case only sometimes.
- if (i % 2 == 0) {
- current = map.Remove(current);
- } else {
- current = map.Next(current);
- }
- }
- EXPECT_EQ(6, i);
-}
-
} // namespace dart
« no previous file with comments | « no previous file | runtime/platform/hashmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698