diff options
author | Tim King <taking@cs.nyu.edu> | 2010-05-25 21:45:18 +0000 |
---|---|---|
committer | Tim King <taking@cs.nyu.edu> | 2010-05-25 21:45:18 +0000 |
commit | 2635899db4a7622a206e2ec562d01e3337a92199 (patch) | |
tree | 43222be9c81680f93120e8e82100b8d46b821f2a /test/unit/util | |
parent | e87c14798b99ccb586751d291b0eeb3208265bd8 (diff) |
Added Rational constructors that only take a numerator. The const char* Rational and Integer constructors are now explicit. This means that 'Integer = 3;' and so on are no longer permitted. This closes bug 121.
Diffstat (limited to 'test/unit/util')
-rw-r--r-- | test/unit/util/integer_black.h | 6 | ||||
-rw-r--r-- | test/unit/util/rational_white.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/util/integer_black.h b/test/unit/util/integer_black.h index 8b8faf895..627167ad3 100644 --- a/test/unit/util/integer_black.h +++ b/test/unit/util/integer_black.h @@ -57,6 +57,12 @@ public: TS_ASSERT_EQUALS(z7.getUnsignedLong(), 1536729ul); } + void testCompareAgainstZero(){ + Integer z(0); + TS_ASSERT_THROWS_NOTHING(z == 0;); + TS_ASSERT_EQUALS(z,0); + } + void testOperatorAssign(){ Integer x(0); Integer y(79); diff --git a/test/unit/util/rational_white.h b/test/unit/util/rational_white.h index 8a7f04fd3..45f1301f3 100644 --- a/test/unit/util/rational_white.h +++ b/test/unit/util/rational_white.h @@ -32,6 +32,12 @@ public: TS_ASSERT_THROWS_NOTHING( delete q ); } + void testCompareAgainstZero(){ + Rational q(0); + TS_ASSERT_THROWS_NOTHING(q == 0;); + TS_ASSERT_EQUALS(q,0); + } + void testConstructors(){ Rational zero; //Default constructor TS_ASSERT_EQUALS(0L, zero.getNumerator().getLong()); |