diff options
author | Willem Jan Palenstijn | 2008-05-28 18:32:05 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2008-05-28 18:32:05 +0000 |
commit | 90bf3de2d66a6605fad7f6a050fae6d277d15f56 (patch) | |
tree | 344f092bbde67ff93d3ff8c2c1b64310ed864879 | |
parent | 16b0905bb0b5e164a2014031749a61c24c6af32b (diff) | |
download | scummvm-rg350-90bf3de2d66a6605fad7f6a050fae6d277d15f56.tar.gz scummvm-rg350-90bf3de2d66a6605fad7f6a050fae6d277d15f56.tar.bz2 scummvm-rg350-90bf3de2d66a6605fad7f6a050fae6d277d15f56.zip |
Decrement _nele when erasing an element from hashmap, and add a test-case for this bug.
svn-id: r32343
-rw-r--r-- | common/hashmap.h | 1 | ||||
-rw-r--r-- | test/common/hashmap.h | 3 |
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 ) |