aboutsummaryrefslogtreecommitdiff
path: root/test/common/hashmap.h
diff options
context:
space:
mode:
authorMax Horn2009-05-19 11:22:49 +0000
committerMax Horn2009-05-19 11:22:49 +0000
commit2b32ba7cb375dd80a119f56f661811971c671ca3 (patch)
tree869e79cdda9239b3939eb767d3d53e0f1361cc13 /test/common/hashmap.h
parentc24559877d82d3a936177c9b502a35627ded0c15 (diff)
downloadscummvm-rg350-2b32ba7cb375dd80a119f56f661811971c671ca3.tar.gz
scummvm-rg350-2b32ba7cb375dd80a119f56f661811971c671ca3.tar.bz2
scummvm-rg350-2b32ba7cb375dd80a119f56f661811971c671ca3.zip
Converted unit tests to use TS_ASSERT_EQUALS / TS_ASSERT_DIFFERS where possible; also made them comply a bit more to our code formatting guideline
svn-id: r40722
Diffstat (limited to 'test/common/hashmap.h')
-rw-r--r--test/common/hashmap.h66
1 files changed, 33 insertions, 33 deletions
diff --git a/test/common/hashmap.h b/test/common/hashmap.h
index 97c7df5bbd..c62f909f95 100644
--- a/test/common/hashmap.h
+++ b/test/common/hashmap.h
@@ -8,38 +8,38 @@ class HashMapTestSuite : public CxxTest::TestSuite
public:
void test_empty_clear() {
Common::HashMap<int, int> container;
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
container[0] = 17;
container[1] = 33;
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.clear();
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
Common::StringMap container2;
- TS_ASSERT( container2.empty() );
+ TS_ASSERT(container2.empty());
container2["foo"] = "bar";
container2["quux"] = "blub";
- TS_ASSERT( !container2.empty() );
+ TS_ASSERT(!container2.empty());
container2.clear();
- TS_ASSERT( container2.empty() );
+ TS_ASSERT(container2.empty());
}
void test_contains() {
Common::HashMap<int, int> container;
container[0] = 17;
container[1] = 33;
- TS_ASSERT( container.contains(0) );
- TS_ASSERT( container.contains(1) );
- TS_ASSERT( !container.contains(17) );
- TS_ASSERT( !container.contains(-1) );
+ TS_ASSERT(container.contains(0));
+ TS_ASSERT(container.contains(1));
+ TS_ASSERT(!container.contains(17));
+ TS_ASSERT(!container.contains(-1));
Common::StringMap container2;
container2["foo"] = "bar";
container2["quux"] = "blub";
- TS_ASSERT( container2.contains("foo") );
- TS_ASSERT( container2.contains("quux") );
- TS_ASSERT( !container2.contains("bar") );
- TS_ASSERT( !container2.contains("asdf") );
+ TS_ASSERT(container2.contains("foo"));
+ TS_ASSERT(container2.contains("quux"));
+ TS_ASSERT(!container2.contains("bar"));
+ TS_ASSERT(!container2.contains("asdf"));
}
void test_add_remove() {
@@ -49,26 +49,26 @@ class HashMapTestSuite : public CxxTest::TestSuite
container[2] = 45;
container[3] = 12;
container[4] = 96;
- TS_ASSERT( container.contains(1) );
+ TS_ASSERT(container.contains(1));
container.erase(1);
- TS_ASSERT( !container.contains(1) );
+ TS_ASSERT(!container.contains(1));
container[1] = 42;
- TS_ASSERT( container.contains(1) );
+ TS_ASSERT(container.contains(1));
container.erase(0);
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.erase(1);
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.erase(2);
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.erase(3);
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.erase(4);
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
container[1] = 33;
- TS_ASSERT( container.contains(1) );
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(container.contains(1));
+ TS_ASSERT(!container.empty());
container.erase(1);
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
}
void test_lookup() {
@@ -79,26 +79,26 @@ class HashMapTestSuite : public CxxTest::TestSuite
container[3] = 12;
container[4] = 96;
- TS_ASSERT_EQUALS( container[0], 17 );
- TS_ASSERT_EQUALS( container[1], -1 );
- TS_ASSERT_EQUALS( container[2], 45 );
- TS_ASSERT_EQUALS( container[3], 12 );
- TS_ASSERT_EQUALS( container[4], 96 );
+ TS_ASSERT_EQUALS(container[0], 17);
+ TS_ASSERT_EQUALS(container[1], -1);
+ TS_ASSERT_EQUALS(container[2], 45);
+ TS_ASSERT_EQUALS(container[3], 12);
+ TS_ASSERT_EQUALS(container[4], 96);
}
void test_iterator_begin_end() {
Common::HashMap<int, int> container;
// The container is initially empty ...
- TS_ASSERT( container.begin() == container.end() );
+ TS_ASSERT_EQUALS(container.begin(), container.end());
// ... then non-empty ...
container[324] = 33;
- TS_ASSERT( container.begin() != container.end() );
+ TS_ASSERT_DIFFERS(container.begin(), container.end());
// ... and again empty.
container.clear();
- TS_ASSERT( container.begin() == container.end() );
+ TS_ASSERT_EQUALS(container.begin(), container.end());
}
void test_hash_map_copy() {