aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-05-19 11:22:49 +0000
committerMax Horn2009-05-19 11:22:49 +0000
commit2b32ba7cb375dd80a119f56f661811971c671ca3 (patch)
tree869e79cdda9239b3939eb767d3d53e0f1361cc13
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
-rw-r--r--test/common/array.h104
-rw-r--r--test/common/bufferedreadstream.h8
-rw-r--r--test/common/bufferedseekablereadstream.h42
-rw-r--r--test/common/hashmap.h66
-rw-r--r--test/common/list.h120
-rw-r--r--test/common/pack.h12
-rw-r--r--test/common/ptr.h13
-rw-r--r--test/common/rect.h38
-rw-r--r--test/common/seekablesubreadstream.h42
-rw-r--r--test/common/str.h98
-rw-r--r--test/common/stream.h26
-rw-r--r--test/common/subreadstream.h8
12 files changed, 289 insertions, 288 deletions
diff --git a/test/common/array.h b/test/common/array.h
index 68b4fa3a93..cb793004a4 100644
--- a/test/common/array.h
+++ b/test/common/array.h
@@ -8,12 +8,12 @@ class ArrayTestSuite : public CxxTest::TestSuite
public:
void test_empty_clear() {
Common::Array<int> array;
- TS_ASSERT( array.empty() );
+ TS_ASSERT(array.empty());
array.push_back(17);
array.push_back(33);
- TS_ASSERT( !array.empty() );
+ TS_ASSERT(!array.empty());
array.clear();
- TS_ASSERT( array.empty() );
+ TS_ASSERT(array.empty());
}
void test_iterator() {
@@ -30,18 +30,18 @@ class ArrayTestSuite : public CxxTest::TestSuite
iter = array.begin();
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
++iter;
- TS_ASSERT( iter != array.end() );
+ TS_ASSERT_DIFFERS(iter, array.end());
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
++iter;
- TS_ASSERT( iter != array.end() );
+ TS_ASSERT_DIFFERS(iter, array.end());
// Also test the postinc
- TS_ASSERT_EQUALS( *iter, -11 );
+ TS_ASSERT_EQUALS(*iter, -11);
iter++;
- TS_ASSERT( iter == array.end() );
+ TS_ASSERT_EQUALS(iter, array.end());
}
void test_direct_access() {
@@ -52,9 +52,9 @@ class ArrayTestSuite : public CxxTest::TestSuite
array.push_back(33);
array.push_back(-11);
- TS_ASSERT_EQUALS( array[0], 17 );
- TS_ASSERT_EQUALS( array[1], 33 );
- TS_ASSERT_EQUALS( array[2], -11 );
+ TS_ASSERT_EQUALS(array[0], 17);
+ TS_ASSERT_EQUALS(array[1], 33);
+ TS_ASSERT_EQUALS(array[2], -11);
}
void test_insert_at() {
@@ -69,13 +69,13 @@ class ArrayTestSuite : public CxxTest::TestSuite
// Insert some data
array.insert_at(2, 33);
- TS_ASSERT_EQUALS( array[0], -12 );
- TS_ASSERT_EQUALS( array[1], 17 );
- TS_ASSERT_EQUALS( array[2], 33 );
- TS_ASSERT_EQUALS( array[3], 25 );
- TS_ASSERT_EQUALS( array[4], -11 );
+ TS_ASSERT_EQUALS(array[0], -12);
+ TS_ASSERT_EQUALS(array[1], 17);
+ TS_ASSERT_EQUALS(array[2], 33);
+ TS_ASSERT_EQUALS(array[3], 25);
+ TS_ASSERT_EQUALS(array[4], -11);
- TS_ASSERT_EQUALS( array.size(), (unsigned int)5 );
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)5);
}
void test_remove_at() {
@@ -91,12 +91,12 @@ class ArrayTestSuite : public CxxTest::TestSuite
// Remove some data
array.remove_at(1);
- TS_ASSERT_EQUALS( array[0], -12 );
- TS_ASSERT_EQUALS( array[1], 33 );
- TS_ASSERT_EQUALS( array[2], 25 );
- TS_ASSERT_EQUALS( array[3], -11 );
+ TS_ASSERT_EQUALS(array[0], -12);
+ TS_ASSERT_EQUALS(array[1], 33);
+ TS_ASSERT_EQUALS(array[2], 25);
+ TS_ASSERT_EQUALS(array[3], -11);
- TS_ASSERT_EQUALS( array.size(), (unsigned int)4 );
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)4);
}
void test_push_back() {
@@ -113,15 +113,15 @@ class ArrayTestSuite : public CxxTest::TestSuite
array1.push_back(array2);
- TS_ASSERT_EQUALS( array1[0], -3 );
- TS_ASSERT_EQUALS( array1[1], 5 );
- TS_ASSERT_EQUALS( array1[2], 9 );
- TS_ASSERT_EQUALS( array1[3], 3 );
- TS_ASSERT_EQUALS( array1[4], -2 );
- TS_ASSERT_EQUALS( array1[5], -131 );
+ TS_ASSERT_EQUALS(array1[0], -3);
+ TS_ASSERT_EQUALS(array1[1], 5);
+ TS_ASSERT_EQUALS(array1[2], 9);
+ TS_ASSERT_EQUALS(array1[3], 3);
+ TS_ASSERT_EQUALS(array1[4], -2);
+ TS_ASSERT_EQUALS(array1[5], -131);
- TS_ASSERT_EQUALS( array1.size(), (unsigned int)6 );
- TS_ASSERT_EQUALS( array2.size(), (unsigned int)3 );
+ TS_ASSERT_EQUALS(array1.size(), (unsigned int)6);
+ TS_ASSERT_EQUALS(array2.size(), (unsigned int)3);
}
void test_copy_constructor() {
@@ -134,11 +134,11 @@ class ArrayTestSuite : public CxxTest::TestSuite
Common::Array<int> array2(array1);
- TS_ASSERT_EQUALS( array2[0], -3 );
- TS_ASSERT_EQUALS( array2[1], 5 );
- TS_ASSERT_EQUALS( array2[2], 9 );
+ TS_ASSERT_EQUALS(array2[0], -3);
+ TS_ASSERT_EQUALS(array2[1], 5);
+ TS_ASSERT_EQUALS(array2[2], 9);
- TS_ASSERT_EQUALS( array2.size(), (unsigned int)3 );
+ TS_ASSERT_EQUALS(array2.size(), (unsigned int)3);
}
void test_array_constructor() {
@@ -146,11 +146,11 @@ class ArrayTestSuite : public CxxTest::TestSuite
Common::Array<int> array2(array1, 3);
- TS_ASSERT_EQUALS( array2[0], -3 );
- TS_ASSERT_EQUALS( array2[1], 5 );
- TS_ASSERT_EQUALS( array2[2], 9 );
+ TS_ASSERT_EQUALS(array2[0], -3);
+ TS_ASSERT_EQUALS(array2[1], 5);
+ TS_ASSERT_EQUALS(array2[2], 9);
- TS_ASSERT_EQUALS( array2.size(), (unsigned int)3 );
+ TS_ASSERT_EQUALS(array2.size(), (unsigned int)3);
}
void test_array_constructor_str() {
@@ -158,11 +158,11 @@ class ArrayTestSuite : public CxxTest::TestSuite
Common::StringList array2(array1, 3);
- TS_ASSERT_EQUALS( array2[0], "a" );
- TS_ASSERT_EQUALS( array2[1], "b" );
- TS_ASSERT_EQUALS( array2[2], "c" );
+ TS_ASSERT_EQUALS(array2[0], "a");
+ TS_ASSERT_EQUALS(array2[1], "b");
+ TS_ASSERT_EQUALS(array2[2], "c");
- TS_ASSERT_EQUALS( array2.size(), (unsigned int)3 );
+ TS_ASSERT_EQUALS(array2.size(), (unsigned int)3);
}
void test_front_back_push_pop() {
@@ -188,24 +188,24 @@ class ArrayTestSuite : public CxxTest::TestSuite
Common::Array<int> array;
array.resize(3);
- TS_ASSERT_EQUALS( array.size(), (unsigned int)3 );
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)3);
array[0] = -3;
array[1] = 163;
array[2] = 17;
array.resize(100);
- TS_ASSERT_EQUALS( array.size(), (unsigned int)100 );
- TS_ASSERT_EQUALS( array[0], -3 );
- TS_ASSERT_EQUALS( array[1], 163 );
- TS_ASSERT_EQUALS( array[2], 17 );
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)100);
+ TS_ASSERT_EQUALS(array[0], -3);
+ TS_ASSERT_EQUALS(array[1], 163);
+ TS_ASSERT_EQUALS(array[2], 17);
- TS_ASSERT_EQUALS( array[99], 0 );
+ TS_ASSERT_EQUALS(array[99], 0);
array.resize(2);
- TS_ASSERT_EQUALS( array.size(), (unsigned int)2 );
- TS_ASSERT_EQUALS( array[0], -3 );
- TS_ASSERT_EQUALS( array[1], 163 );
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)2);
+ TS_ASSERT_EQUALS(array[0], -3);
+ TS_ASSERT_EQUALS(array[1], 163);
}
};
diff --git a/test/common/bufferedreadstream.h b/test/common/bufferedreadstream.h
index 15026aa8d6..c171836466 100644
--- a/test/common/bufferedreadstream.h
+++ b/test/common/bufferedreadstream.h
@@ -15,16 +15,16 @@ class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
byte i, b;
for (i = 0; i < 10; ++i) {
- TS_ASSERT( !srs.eos() );
+ TS_ASSERT(!srs.eos());
b = srs.readByte();
- TS_ASSERT_EQUALS( i, b );
+ TS_ASSERT_EQUALS(i, b);
}
- TS_ASSERT( !srs.eos() );
+ TS_ASSERT(!srs.eos());
b = srs.readByte();
- TS_ASSERT ( srs.eos() );
+ TS_ASSERT(srs.eos());
}
};
diff --git a/test/common/bufferedseekablereadstream.h b/test/common/bufferedseekablereadstream.h
index ea2ffe068a..1b9caddbb8 100644
--- a/test/common/bufferedseekablereadstream.h
+++ b/test/common/bufferedseekablereadstream.h
@@ -12,18 +12,18 @@ class BufferedSeekableReadStreamTestSuite : public CxxTest::TestSuite {
byte i, b;
for (i = 0; i < 10; ++i) {
- TS_ASSERT( !ssrs.eos() );
+ TS_ASSERT(!ssrs.eos());
- TS_ASSERT_EQUALS( i, ssrs.pos() );
+ TS_ASSERT_EQUALS(i, ssrs.pos());
ssrs.read(&b, 1);
- TS_ASSERT_EQUALS( i, b );
+ TS_ASSERT_EQUALS(i, b);
}
- TS_ASSERT( !ssrs.eos() );
+ TS_ASSERT(!ssrs.eos());
- TS_ASSERT( 0 == ssrs.read(&b, 1) );
- TS_ASSERT( ssrs.eos() );
+ TS_ASSERT_EQUALS(0, ssrs.read(&b, 1));
+ TS_ASSERT(ssrs.eos());
}
void test_seek() {
@@ -33,38 +33,38 @@ class BufferedSeekableReadStreamTestSuite : public CxxTest::TestSuite {
Common::BufferedSeekableReadStream ssrs(&ms, 4);
byte b;
- TS_ASSERT_EQUALS( ssrs.pos(), 0 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 0);
ssrs.seek(1, SEEK_SET);
- TS_ASSERT_EQUALS( ssrs.pos(), 1 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 1);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 1 );
+ TS_ASSERT_EQUALS(b, 1);
ssrs.seek(5, SEEK_CUR);
- TS_ASSERT_EQUALS( ssrs.pos(), 7 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 7);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 7 );
+ TS_ASSERT_EQUALS(b, 7);
ssrs.seek(-3, SEEK_CUR);
- TS_ASSERT_EQUALS( ssrs.pos(), 5 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 5);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 5 );
+ TS_ASSERT_EQUALS(b, 5);
ssrs.seek(0, SEEK_END);
- TS_ASSERT_EQUALS( ssrs.pos(), 10 );
- TS_ASSERT( !ssrs.eos() );
+ TS_ASSERT_EQUALS(ssrs.pos(), 10);
+ TS_ASSERT(!ssrs.eos());
b = ssrs.readByte();
- TS_ASSERT( ssrs.eos() );
+ TS_ASSERT(ssrs.eos());
ssrs.seek(-3, SEEK_END);
- TS_ASSERT( !ssrs.eos() );
- TS_ASSERT_EQUALS( ssrs.pos(), 7 );
+ TS_ASSERT(!ssrs.eos());
+ TS_ASSERT_EQUALS(ssrs.pos(), 7);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 7 );
+ TS_ASSERT_EQUALS(b, 7);
ssrs.seek(-8, SEEK_END);
- TS_ASSERT_EQUALS( ssrs.pos(), 2 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 2);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 2 );
+ TS_ASSERT_EQUALS(b, 2);
}
};
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() {
diff --git a/test/common/list.h b/test/common/list.h
index 3b6b9a1721..232aa82bd8 100644
--- a/test/common/list.h
+++ b/test/common/list.h
@@ -7,39 +7,39 @@ class ListTestSuite : public CxxTest::TestSuite
public:
void test_empty_clear() {
Common::List<int> container;
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
container.push_back(17);
container.push_back(33);
- TS_ASSERT( !container.empty() );
+ TS_ASSERT(!container.empty());
container.clear();
- TS_ASSERT( container.empty() );
+ TS_ASSERT(container.empty());
}
public:
void test_size() {
Common::List<int> container;
- TS_ASSERT_EQUALS( container.size(), (unsigned int)0 );
+ TS_ASSERT_EQUALS(container.size(), (unsigned int)0);
container.push_back(17);
- TS_ASSERT_EQUALS( container.size(), (unsigned int)1 );
+ TS_ASSERT_EQUALS(container.size(), (unsigned int)1);
container.push_back(33);
- TS_ASSERT_EQUALS( container.size(), (unsigned int)2 );
+ TS_ASSERT_EQUALS(container.size(), (unsigned int)2);
container.clear();
- TS_ASSERT_EQUALS( container.size(), (unsigned int)0 );
+ TS_ASSERT_EQUALS(container.size(), (unsigned int)0);
}
void test_iterator_begin_end() {
Common::List<int> container;
// The container is initially empty ...
- TS_ASSERT( container.begin() == container.end() );
+ TS_ASSERT_EQUALS(container.begin(), container.end());
// ... then non-empty ...
container.push_back(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_iterator() {
@@ -58,32 +58,32 @@ class ListTestSuite : public CxxTest::TestSuite
iter = container.begin();
cIter = container.begin();
- TS_ASSERT( iter == cIter );
+ TS_ASSERT_EQUALS(iter, cIter);
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
++iter;
++cIter;
- TS_ASSERT( iter != container.end() );
- TS_ASSERT( cIter != container.end() );
- TS_ASSERT( iter == cIter );
+ TS_ASSERT_DIFFERS(iter, container.end());
+ TS_ASSERT_DIFFERS(cIter, container.end());
+ TS_ASSERT_EQUALS(iter, cIter);
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
++iter;
++cIter;
- TS_ASSERT( iter != container.end() );
- TS_ASSERT( cIter != container.end() );
- TS_ASSERT( iter == cIter );
+ TS_ASSERT_DIFFERS(iter, container.end());
+ TS_ASSERT_DIFFERS(cIter, container.end());
+ TS_ASSERT_EQUALS(iter, cIter);
// Also test the postinc
- TS_ASSERT_EQUALS( *iter, -11 );
+ TS_ASSERT_EQUALS(*iter, -11);
iter++;
cIter++;
- TS_ASSERT( iter == container.end() );
- TS_ASSERT( cIter == container.end() );
- TS_ASSERT( iter == cIter );
+ TS_ASSERT_EQUALS(iter, container.end());
+ TS_ASSERT_EQUALS(cIter, container.end());
+ TS_ASSERT_EQUALS(iter, cIter);
cIter = iter;
- TS_ASSERT( iter == cIter );
+ TS_ASSERT_EQUALS(iter, cIter);
}
void test_insert() {
@@ -107,25 +107,25 @@ class ListTestSuite : public CxxTest::TestSuite
// Verify contents are correct
iter = container.begin();
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 42 );
+ TS_ASSERT_EQUALS(*iter, 42);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 43 );
+ TS_ASSERT_EQUALS(*iter, 43);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, -11 );
+ TS_ASSERT_EQUALS(*iter, -11);
++iter;
- TS_ASSERT( iter == container.end() );
+ TS_ASSERT_EQUALS(iter, container.end());
}
void test_erase() {
@@ -155,17 +155,17 @@ class ListTestSuite : public CxxTest::TestSuite
// Verify contents are correct
Common::List<int>::iterator iter = container.begin();
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 43 );
+ TS_ASSERT_EQUALS(*iter, 43);
++iter;
- TS_ASSERT( iter == container.end() );
+ TS_ASSERT_EQUALS(iter, container.end());
}
void test_remove() {
@@ -191,17 +191,17 @@ class ListTestSuite : public CxxTest::TestSuite
// Verify contents are correct
Common::List<int>::iterator iter = container.begin();
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
++iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 43 );
+ TS_ASSERT_EQUALS(*iter, 43);
++iter;
- TS_ASSERT( iter == container.end() );
+ TS_ASSERT_EQUALS(iter, container.end());
}
void test_reverse() {
@@ -214,36 +214,36 @@ class ListTestSuite : public CxxTest::TestSuite
container.push_back(-11);
iter = container.reverse_begin();
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, -11 );
+ TS_ASSERT_EQUALS(*iter, -11);
--iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_EQUALS(*iter, 33);
--iter;
- TS_ASSERT( iter != container.end() );
+ TS_ASSERT_DIFFERS(iter, container.end());
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_EQUALS(*iter, 17);
--iter;
- TS_ASSERT( iter == container.end() );
+ TS_ASSERT_EQUALS(iter, container.end());
iter = container.reverse_begin();
iter = container.reverse_erase(iter);
- TS_ASSERT( iter != container.end() );
- TS_ASSERT_EQUALS( *iter, 33 );
+ TS_ASSERT_DIFFERS(iter, container.end());
+ TS_ASSERT_EQUALS(*iter, 33);
iter = container.reverse_erase(iter);
- TS_ASSERT( iter != container.end() );
- TS_ASSERT_EQUALS( *iter, 17 );
+ TS_ASSERT_DIFFERS(iter, container.end());
+ TS_ASSERT_EQUALS(*iter, 17);
iter = container.reverse_erase(iter);
- TS_ASSERT( iter == container.end() );
+ TS_ASSERT_EQUALS(iter, container.end());
- TS_ASSERT( container.begin() == container.end() );
- TS_ASSERT( container.reverse_begin() == container.end() );
+ TS_ASSERT_EQUALS(container.begin(), container.end());
+ TS_ASSERT_EQUALS(container.reverse_begin(), container.end());
}
void test_front_back_push_pop() {
diff --git a/test/common/pack.h b/test/common/pack.h
index e2c4fb79a2..724457f838 100644
--- a/test/common/pack.h
+++ b/test/common/pack.h
@@ -21,14 +21,14 @@ class PackTestSuite : public CxxTest::TestSuite
{
public:
void test_packing() {
- TS_ASSERT_EQUALS( sizeof(TestStruct), size_t(4+1+2+4+1) );
+ TS_ASSERT_EQUALS(sizeof(TestStruct), size_t(4+1+2+4+1));
}
void test_offsets() {
- TS_ASSERT_EQUALS( OFFS(TestStruct, x), (ptrdiff_t)0 );
- TS_ASSERT_EQUALS( OFFS(TestStruct, y), (ptrdiff_t)4 );
- TS_ASSERT_EQUALS( OFFS(TestStruct, z), (ptrdiff_t)5 );
- TS_ASSERT_EQUALS( OFFS(TestStruct, a), (ptrdiff_t)7 );
- TS_ASSERT_EQUALS( OFFS(TestStruct, b), (ptrdiff_t)11 );
+ TS_ASSERT_EQUALS(OFFS(TestStruct, x), (ptrdiff_t)0);
+ TS_ASSERT_EQUALS(OFFS(TestStruct, y), (ptrdiff_t)4);
+ TS_ASSERT_EQUALS(OFFS(TestStruct, z), (ptrdiff_t)5);
+ TS_ASSERT_EQUALS(OFFS(TestStruct, a), (ptrdiff_t)7);
+ TS_ASSERT_EQUALS(OFFS(TestStruct, b), (ptrdiff_t)11);
}
};
diff --git a/test/common/ptr.h b/test/common/ptr.h
index 3071c3c0ca..4bd81f8004 100644
--- a/test/common/ptr.h
+++ b/test/common/ptr.h
@@ -13,21 +13,22 @@ class PtrTestSuite : public CxxTest::TestSuite
{
Common::SharedPtr<int> p2 = p1;
TS_ASSERT(!p1.unique());
- TS_ASSERT(p1.refCount() == p2.refCount());
- TS_ASSERT(p1.refCount() == 2);
- TS_ASSERT(p1 == p2);
+ TS_ASSERT_EQUALS(p1.refCount(), p2.refCount());
+ TS_ASSERT_EQUALS(p1.refCount(), 2);
+ TS_ASSERT_EQUALS(p1, p2);
TS_ASSERT_EQUALS(*p2, 1);
{
Common::SharedPtr<int> p3;
p3 = p2;
- TS_ASSERT(p3 == p2 && p3 == p1);
- TS_ASSERT(p1.refCount() == 3);
+ TS_ASSERT_EQUALS(p3, p2);
+ TS_ASSERT_EQUALS(p3, p1);
+ TS_ASSERT_EQUALS(p1.refCount(), 3);
TS_ASSERT_EQUALS(*p3, 1);
*p3 = 0;
TS_ASSERT_EQUALS(*p3, 0);
}
TS_ASSERT_EQUALS(*p2, 0);
- TS_ASSERT(p1.refCount() == 2);
+ TS_ASSERT_EQUALS(p1.refCount(), 2);
}
TS_ASSERT_EQUALS(*p1, 0);
diff --git a/test/common/rect.h b/test/common/rect.h
index 7b68a3b844..11c743dc9c 100644
--- a/test/common/rect.h
+++ b/test/common/rect.h
@@ -11,43 +11,43 @@ class RectTestSuite : public CxxTest::TestSuite
Common::Point p21(2, 1);
Common::Point p23(2, 3);
Common::Point p32(3, 2);
- TS_ASSERT_EQUALS( p0.sqrDist(p11), (uint) 2 );
- TS_ASSERT_EQUALS( p0.sqrDist(p21), (uint) 5 );
- TS_ASSERT_EQUALS( p0.sqrDist(p23), p0.sqrDist(p32) );
- TS_ASSERT_EQUALS( p11.sqrDist(p11), (uint) 0 );
- TS_ASSERT_EQUALS( p11.sqrDist(p23), (uint) 5 );
+ TS_ASSERT_EQUALS(p0.sqrDist(p11), (uint) 2);
+ TS_ASSERT_EQUALS(p0.sqrDist(p21), (uint) 5);
+ TS_ASSERT_EQUALS(p0.sqrDist(p23), p0.sqrDist(p32));
+ TS_ASSERT_EQUALS(p11.sqrDist(p11), (uint) 0);
+ TS_ASSERT_EQUALS(p11.sqrDist(p23), (uint) 5);
}
void test_intersects() {
- TS_ASSERT( Common::Rect(0, 0, 2, 2).intersects(Common::Rect(0, 0, 1, 1)) );
- TS_ASSERT( Common::Rect(0, 0, 2, 2).intersects(Common::Rect(1, 1, 2, 2)) );
- TS_ASSERT( !Common::Rect(0, 0, 1, 1).intersects(Common::Rect(1, 1, 2, 2)) );
+ TS_ASSERT(Common::Rect(0, 0, 2, 2).intersects(Common::Rect(0, 0, 1, 1)));
+ TS_ASSERT(Common::Rect(0, 0, 2, 2).intersects(Common::Rect(1, 1, 2, 2)));
+ TS_ASSERT(!Common::Rect(0, 0, 1, 1).intersects(Common::Rect(1, 1, 2, 2)));
}
void test_contains() {
Common::Rect r0;
Common::Rect r1(0, 0, 1, 1);
Common::Rect r2(0, 0, 2, 2);
- TS_ASSERT( !r0.contains(r1) );
- TS_ASSERT( !r0.contains(r2) );
- TS_ASSERT( !r1.contains(r2) );
- TS_ASSERT( r0.contains(r0) );
+ TS_ASSERT(!r0.contains(r1));
+ TS_ASSERT(!r0.contains(r2));
+ TS_ASSERT(!r1.contains(r2));
+ TS_ASSERT(r0.contains(r0));
- TS_ASSERT( r1.contains(r0) );
- TS_ASSERT( r1.contains(r1) );
+ TS_ASSERT(r1.contains(r0));
+ TS_ASSERT(r1.contains(r1));
- TS_ASSERT( r2.contains(r0) );
- TS_ASSERT( r2.contains(r1) );
- TS_ASSERT( r2.contains(r2) );
+ TS_ASSERT(r2.contains(r0));
+ TS_ASSERT(r2.contains(r1));
+ TS_ASSERT(r2.contains(r2));
}
void test_extend() {
Common::Rect r0;
Common::Rect r1(0, 0, 1, 1);
Common::Rect r2(0, 0, 2, 2);
- TS_ASSERT( !r0.contains(r1) );
+ TS_ASSERT(!r0.contains(r1));
r0.extend(r1);
- TS_ASSERT( r0.contains(r1) );
+ TS_ASSERT(r0.contains(r1));
TS_ASSERT_EQUALS(r0.top, 0);
TS_ASSERT_EQUALS(r0.left, 0);
TS_ASSERT_EQUALS(r0.bottom, 1);
diff --git a/test/common/seekablesubreadstream.h b/test/common/seekablesubreadstream.h
index 7c3a3249c4..126edcd978 100644
--- a/test/common/seekablesubreadstream.h
+++ b/test/common/seekablesubreadstream.h
@@ -15,17 +15,17 @@ class SeekableSubReadStreamTestSuite : public CxxTest::TestSuite {
int i;
byte b;
for (i = start; i < end; ++i) {
- TS_ASSERT( !ssrs.eos() );
+ TS_ASSERT(!ssrs.eos());
- TS_ASSERT_EQUALS( i - start, ssrs.pos() );
+ TS_ASSERT_EQUALS(i - start, ssrs.pos());
ssrs.read(&b, 1);
- TS_ASSERT_EQUALS( i, b );
+ TS_ASSERT_EQUALS(i, b);
}
- TS_ASSERT( !ssrs.eos() );
- TS_ASSERT( 0 == ssrs.read(&b, 1) );
- TS_ASSERT( ssrs.eos() );
+ TS_ASSERT(!ssrs.eos());
+ TS_ASSERT_EQUALS(0, ssrs.read(&b, 1));
+ TS_ASSERT(ssrs.eos());
}
void test_seek() {
@@ -35,38 +35,38 @@ class SeekableSubReadStreamTestSuite : public CxxTest::TestSuite {
Common::SeekableSubReadStream ssrs(&ms, 1, 9);
byte b;
- TS_ASSERT_EQUALS( ssrs.pos(), 0 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 0);
ssrs.seek(1, SEEK_SET);
- TS_ASSERT_EQUALS( ssrs.pos(), 1 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 1);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 2 );
+ TS_ASSERT_EQUALS(b, 2);
ssrs.seek(5, SEEK_CUR);
- TS_ASSERT_EQUALS( ssrs.pos(), 7 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 7);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 8 );
+ TS_ASSERT_EQUALS(b, 8);
ssrs.seek(-3, SEEK_CUR);
- TS_ASSERT_EQUALS( ssrs.pos(), 5 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 5);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 6 );
+ TS_ASSERT_EQUALS(b, 6);
ssrs.seek(0, SEEK_END);
- TS_ASSERT_EQUALS( ssrs.pos(), 8 );
- TS_ASSERT( !ssrs.eos() );
+ TS_ASSERT_EQUALS(ssrs.pos(), 8);
+ TS_ASSERT(!ssrs.eos());
b = ssrs.readByte();
- TS_ASSERT( ssrs.eos() );
+ TS_ASSERT(ssrs.eos());
ssrs.seek(-3, SEEK_END);
- TS_ASSERT( !ssrs.eos() );
- TS_ASSERT_EQUALS( ssrs.pos(), 5 );
+ TS_ASSERT(!ssrs.eos());
+ TS_ASSERT_EQUALS(ssrs.pos(), 5);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 6 );
+ TS_ASSERT_EQUALS(b, 6);
ssrs.seek(-8, SEEK_END);
- TS_ASSERT_EQUALS( ssrs.pos(), 0 );
+ TS_ASSERT_EQUALS(ssrs.pos(), 0);
b = ssrs.readByte();
- TS_ASSERT_EQUALS( b, 1 );
+ TS_ASSERT_EQUALS(b, 1);
}
};
diff --git a/test/common/str.h b/test/common/str.h
index 62b30cb229..887e11360f 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -7,28 +7,28 @@ class StringTestSuite : public CxxTest::TestSuite
public:
void test_constructors() {
Common::String str("test-string");
- TS_ASSERT( str == "test-string");
+ TS_ASSERT_EQUALS(str, "test-string");
str = Common::String(str.c_str()+5, 3);
- TS_ASSERT( str == "str");
+ TS_ASSERT_EQUALS(str, "str");
str = "test-string";
- TS_ASSERT( str == "test-string");
+ TS_ASSERT_EQUALS(str, "test-string");
str = Common::String(str.c_str()+5, str.c_str()+8);
- TS_ASSERT( str == "str");
+ TS_ASSERT_EQUALS(str, "str");
}
void test_trim() {
Common::String str(" This is a s tring with spaces ");
Common::String str2 = str;
str.trim();
- TS_ASSERT( str == "This is a s tring with spaces");
- TS_ASSERT( str2 == " This is a s tring with spaces ");
+ TS_ASSERT_EQUALS(str, "This is a s tring with spaces");
+ TS_ASSERT_EQUALS(str2, " This is a s tring with spaces ");
}
void test_empty_clear() {
Common::String str("test");
- TS_ASSERT( !str.empty());
+ TS_ASSERT(!str.empty());
str.clear();
- TS_ASSERT( str.empty());
+ TS_ASSERT(str.empty());
}
void test_lastChar() {
@@ -161,75 +161,75 @@ class StringTestSuite : public CxxTest::TestSuite
void test_deleteChar() {
Common::String str("01234567890123456789012345678901");
str.deleteChar(10);
- TS_ASSERT_EQUALS( str, "0123456789123456789012345678901" );
+ TS_ASSERT_EQUALS(str, "0123456789123456789012345678901");
str.deleteChar(10);
- TS_ASSERT_EQUALS( str, "012345678923456789012345678901" );
+ TS_ASSERT_EQUALS(str, "012345678923456789012345678901");
}
void test_sharing() {
Common::String str("01234567890123456789012345678901");
Common::String str2(str);
- TS_ASSERT_EQUALS( str2, "01234567890123456789012345678901" );
+ TS_ASSERT_EQUALS(str2, "01234567890123456789012345678901");
str.deleteLastChar();
- TS_ASSERT_EQUALS( str, "0123456789012345678901234567890" );
- TS_ASSERT_EQUALS( str2, "01234567890123456789012345678901" );
+ TS_ASSERT_EQUALS(str, "0123456789012345678901234567890");
+ TS_ASSERT_EQUALS(str2, "01234567890123456789012345678901");
}
void test_lastPathComponent() {
- TS_ASSERT(Common::lastPathComponent("/", '/') == "");
- TS_ASSERT(Common::lastPathComponent("/foo/bar", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("/foo//bar/", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("/foo/./bar", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("/foo//./bar//", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("/foo//.bar//", '/') == ".bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/", '/'), "");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/foo/bar", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/foo//bar/", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/foo/./bar", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/foo//./bar//", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("/foo//.bar//", '/'), ".bar");
- TS_ASSERT(Common::lastPathComponent("", '/') == "");
- TS_ASSERT(Common::lastPathComponent("foo/bar", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("foo//bar/", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("foo/./bar", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("foo//./bar//", '/') == "bar");
- TS_ASSERT(Common::lastPathComponent("foo//.bar//", '/') == ".bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("", '/'), "");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo/bar", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo//bar/", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo/./bar", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo//./bar//", '/'), "bar");
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo//.bar//", '/'), ".bar");
}
void test_normalizePath() {
- TS_ASSERT(Common::normalizePath("/", '/') == "/");
- TS_ASSERT(Common::normalizePath("/foo/bar", '/') == "/foo/bar");
- TS_ASSERT(Common::normalizePath("/foo//bar/", '/') == "/foo/bar");
- TS_ASSERT(Common::normalizePath("/foo/./bar", '/') == "/foo/bar");
- TS_ASSERT(Common::normalizePath("/foo//./bar//", '/') == "/foo/bar");
- TS_ASSERT(Common::normalizePath("/foo//.bar//", '/') == "/foo/.bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("/", '/'), "/");
+ TS_ASSERT_EQUALS(Common::normalizePath("/foo/bar", '/'), "/foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("/foo//bar/", '/'), "/foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("/foo/./bar", '/'), "/foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("/foo//./bar//", '/'), "/foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("/foo//.bar//", '/'), "/foo/.bar");
- TS_ASSERT(Common::normalizePath("", '/') == "");
- TS_ASSERT(Common::normalizePath("foo/bar", '/') == "foo/bar");
- TS_ASSERT(Common::normalizePath("foo//bar/", '/') == "foo/bar");
- TS_ASSERT(Common::normalizePath("foo/./bar", '/') == "foo/bar");
- TS_ASSERT(Common::normalizePath("foo//./bar//", '/') == "foo/bar");
- TS_ASSERT(Common::normalizePath("foo//.bar//", '/') == "foo/.bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("", '/'), "");
+ TS_ASSERT_EQUALS(Common::normalizePath("foo/bar", '/'), "foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("foo//bar/", '/'), "foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("foo/./bar", '/'), "foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("foo//./bar//", '/'), "foo/bar");
+ TS_ASSERT_EQUALS(Common::normalizePath("foo//.bar//", '/'), "foo/.bar");
}
void test_matchString() {
- TS_ASSERT( Common::matchString("", "*"));
- TS_ASSERT( Common::matchString("a", "*"));
- TS_ASSERT( Common::matchString("monkey.s01", "*"));
+ TS_ASSERT(Common::matchString("", "*"));
+ TS_ASSERT(Common::matchString("a", "*"));
+ TS_ASSERT(Common::matchString("monkey.s01", "*"));
TS_ASSERT(!Common::matchString("", "?"));
- TS_ASSERT( Common::matchString("a", "?"));
+ TS_ASSERT(Common::matchString("a", "?"));
TS_ASSERT(!Common::matchString("monkey.s01", "?"));
- TS_ASSERT( Common::matchString("monkey.s01", "monkey.s??"));
- TS_ASSERT( Common::matchString("monkey.s99", "monkey.s??"));
+ TS_ASSERT(Common::matchString("monkey.s01", "monkey.s??"));
+ TS_ASSERT(Common::matchString("monkey.s99", "monkey.s??"));
TS_ASSERT(!Common::matchString("monkey.s101", "monkey.s??"));
- TS_ASSERT( Common::matchString("monkey.s01", "monkey.s?1"));
+ TS_ASSERT(Common::matchString("monkey.s01", "monkey.s?1"));
TS_ASSERT(!Common::matchString("monkey.s99", "monkey.s?1"));
TS_ASSERT(!Common::matchString("monkey.s101", "monkey.s?1"));
- TS_ASSERT( Common::matchString("monkey.s01", "monkey.s*"));
- TS_ASSERT( Common::matchString("monkey.s99", "monkey.s*"));
- TS_ASSERT( Common::matchString("monkey.s101", "monkey.s*"));
+ TS_ASSERT(Common::matchString("monkey.s01", "monkey.s*"));
+ TS_ASSERT(Common::matchString("monkey.s99", "monkey.s*"));
+ TS_ASSERT(Common::matchString("monkey.s101", "monkey.s*"));
- TS_ASSERT( Common::matchString("monkey.s01", "monkey.s*1"));
+ TS_ASSERT(Common::matchString("monkey.s01", "monkey.s*1"));
TS_ASSERT(!Common::matchString("monkey.s99", "monkey.s*1"));
- TS_ASSERT( Common::matchString("monkey.s101", "monkey.s*1"));
+ TS_ASSERT(Common::matchString("monkey.s101", "monkey.s*1"));
}
};
diff --git a/test/common/stream.h b/test/common/stream.h
index 4e0d608920..553bbe6c66 100644
--- a/test/common/stream.h
+++ b/test/common/stream.h
@@ -10,18 +10,18 @@ class ReadLineStreamTestSuite : public CxxTest::TestSuite {
char buffer[100];
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "ab\n"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "ab\n"));
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "\n"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "\n"));
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "c\n"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "c\n"));
TS_ASSERT(!ms.eos());
- TS_ASSERT(0 == ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
TS_ASSERT(ms.eos());
}
@@ -32,14 +32,14 @@ class ReadLineStreamTestSuite : public CxxTest::TestSuite {
char buffer[100];
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "ab\n"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "ab\n"));
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "\n"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "\n"));
- TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer)));
- TS_ASSERT(0 == strcmp(buffer, "c"));
+ TS_ASSERT_DIFFERS((char *)0, ms.readLine_NEW(buffer, sizeof(buffer)));
+ TS_ASSERT_EQUALS(0, strcmp(buffer, "c"));
TS_ASSERT(ms.eos());
}
diff --git a/test/common/subreadstream.h b/test/common/subreadstream.h
index f68a9860a5..15d959892f 100644
--- a/test/common/subreadstream.h
+++ b/test/common/subreadstream.h
@@ -15,14 +15,14 @@ class SubReadStreamTestSuite : public CxxTest::TestSuite {
int i;
byte b;
for (i = 0; i < end; ++i) {
- TS_ASSERT( !srs.eos() );
+ TS_ASSERT(!srs.eos());
b = srs.readByte();
- TS_ASSERT_EQUALS( i, b );
+ TS_ASSERT_EQUALS(i, b);
}
- TS_ASSERT( !srs.eos() );
+ TS_ASSERT(!srs.eos());
b = srs.readByte();
- TS_ASSERT( srs.eos() );
+ TS_ASSERT(srs.eos());
}
};