diff options
author | Max Horn | 2006-03-28 15:16:04 +0000 |
---|---|---|
committer | Max Horn | 2006-03-28 15:16:04 +0000 |
commit | d3e08aedbb838a36d4ecfc11f87314cf2f1db04f (patch) | |
tree | 5393260b83b276af61c55dc73ccc28030a0cc83c /test/common/hashmap.h | |
parent | 62da4eec26f26d5e2f45af02f5185799df58452b (diff) | |
download | scummvm-rg350-d3e08aedbb838a36d4ecfc11f87314cf2f1db04f.tar.gz scummvm-rg350-d3e08aedbb838a36d4ecfc11f87314cf2f1db04f.tar.bz2 scummvm-rg350-d3e08aedbb838a36d4ecfc11f87314cf2f1db04f.zip |
Adapted unit tests to current situation
svn-id: r21481
Diffstat (limited to 'test/common/hashmap.h')
-rw-r--r-- | test/common/hashmap.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/common/hashmap.h b/test/common/hashmap.h new file mode 100644 index 0000000000..85da1487f4 --- /dev/null +++ b/test/common/hashmap.h @@ -0,0 +1,43 @@ +#include <cxxtest/TestSuite.h> + +#include "common/stdafx.h" +#include "common/hashmap.h" + +class HashMapTestSuite : public CxxTest::TestSuite +{ + public: + void test_empty_clear( void ) + { + Common::HashMap<int, int> map; + TS_ASSERT( map.empty() ); + map[0] = 17; + map[1] = 33; + TS_ASSERT( !map.empty() ); + map.clear(); + TS_ASSERT( map.empty() ); + } + void test_contains( void ) + { + Common::HashMap<int, int> map; + map[0] = 17; + map[1] = 33; + TS_ASSERT( map.contains(0) ); + TS_ASSERT( map.contains(1) ); + TS_ASSERT( !map.contains(17) ); + TS_ASSERT( !map.contains(-1) ); + } + + void test_add_remove( void ) + { + Common::HashMap<int, int> map; + map[0] = 17; + map[1] = 33; + TS_ASSERT( map.contains(1) ); + map.erase(1); + TS_ASSERT( !map.contains(1) ); + map[1] = 42; + TS_ASSERT( map.contains(1) ); + } + + // TODO: Add test cases for iterators, find, ... +}; |