aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-05-17 22:08:19 +0000
committerMax Horn2010-05-17 22:08:19 +0000
commitc56a481f88c23ef394c723cd4ef4c7efec6a7aa9 (patch)
tree641e5d77574b88de11b44a9293a644f026c24db7
parent00cd966f3da11aea4cd1bc5a28808e006f7eff9d (diff)
downloadscummvm-rg350-c56a481f88c23ef394c723cd4ef4c7efec6a7aa9.tar.gz
scummvm-rg350-c56a481f88c23ef394c723cd4ef4c7efec6a7aa9.tar.bz2
scummvm-rg350-c56a481f88c23ef394c723cd4ef4c7efec6a7aa9.zip
Use TS_ASSERT_EQUALS in test cases
svn-id: r49065
-rw-r--r--test/common/rational.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/common/rational.h b/test/common/rational.h
index 5425ec4d81..4248283ade 100644
--- a/test/common/rational.h
+++ b/test/common/rational.h
@@ -40,12 +40,12 @@ public:
Common::Rational r0(6, 3);
Common::Rational r1(1, 2);
- TS_ASSERT(r0 == 2);
- TS_ASSERT(r1 == Common::Rational(1, 2));
+ TS_ASSERT_EQUALS(r0, 2);
+ TS_ASSERT_EQUALS(r1, Common::Rational(1, 2));
r0 = r1;
- TS_ASSERT(r0 == r1);
- TS_ASSERT(r0 == Common::Rational(1, 2));
+ TS_ASSERT_EQUALS(r0, r1);
+ TS_ASSERT_EQUALS(r0, Common::Rational(1, 2));
}
void test_negative() {
@@ -54,19 +54,22 @@ public:
r0 = -r0;
r1 = -r1;
- TS_ASSERT(r0 == -2);
- TS_ASSERT(r1 == Common::Rational(-1, 2));
- TS_ASSERT(r1 == Common::Rational(1, -2));
+ TS_ASSERT_EQUALS(r0, -2);
+ TS_ASSERT_EQUALS(r1, Common::Rational(-1, 2));
+ TS_ASSERT_EQUALS(r1, Common::Rational(1, -2));
+
+ TS_ASSERT_EQUALS(r1, Common::Rational(-25, 50));
+ TS_ASSERT_EQUALS(r1, Common::Rational(25, -50));
}
void test_add_sub() {
const Common::Rational r0(6, 3);
const Common::Rational r1(1, 2);
- TS_ASSERT(r0 + r1 == Common::Rational(5, 2));
- TS_ASSERT(r1 + r0 == Common::Rational(5, 2));
- TS_ASSERT(r0 - r1 == Common::Rational(3, 2));
- TS_ASSERT(r1 - r0 == Common::Rational(-3, 2));
+ TS_ASSERT_EQUALS(r0 + r1, Common::Rational(5, 2));
+ TS_ASSERT_EQUALS(r1 + r0, Common::Rational(5, 2));
+ TS_ASSERT_EQUALS(r0 - r1, Common::Rational(3, 2));
+ TS_ASSERT_EQUALS(r1 - r0, Common::Rational(-3, 2));
}
void test_mul() {
@@ -89,6 +92,6 @@ public:
Common::Rational r0(6, 3);
Common::Rational r1(1, 2);
- TS_ASSERT(r0 / r1 == 4);
+ TS_ASSERT_EQUALS(r0 / r1, 4);
}
};