aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/hashmap.h1
-rw-r--r--test/common/hashmap.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/common/hashmap.h b/common/hashmap.h
index 81a4b0d17e..1bae44e98e 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -535,6 +535,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::erase(const Key &key) {
}
}
_arr[i] = NULL;
+ _nele--;
return;
}
diff --git a/test/common/hashmap.h b/test/common/hashmap.h
index 883e965065..5aa609bc00 100644
--- a/test/common/hashmap.h
+++ b/test/common/hashmap.h
@@ -37,6 +37,9 @@ class HashMapTestSuite : public CxxTest::TestSuite
TS_ASSERT( !container.contains(1) );
container[1] = 42;
TS_ASSERT( container.contains(1) );
+ container.erase(0);
+ container.erase(1);
+ TS_ASSERT( container.empty() );
}
void test_lookup( void )