mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 03:31:40 +00:00
Decrement _nele when erasing an element from hashmap, and add a test-case for this bug.
svn-id: r32343
This commit is contained in:
parent
16b0905bb0
commit
90bf3de2d6
@ -535,6 +535,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::erase(const Key &key) {
|
||||
}
|
||||
}
|
||||
_arr[i] = NULL;
|
||||
_nele--;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user