diff options
Diffstat (limited to 'test/unit/util/integer_black.h')
-rw-r--r-- | test/unit/util/integer_black.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/util/integer_black.h b/test/unit/util/integer_black.h index f4bd1f8b8..66e29a01b 100644 --- a/test/unit/util/integer_black.h +++ b/test/unit/util/integer_black.h @@ -18,6 +18,7 @@ #include <cxxtest/TestSuite.h> #include <sstream> +#include <limits> #include "util/integer.h" @@ -295,6 +296,17 @@ public: TS_ASSERT_EQUALS( Integer(-1000), Integer(-10).pow(3) ); } + void testOverlyLong() { + unsigned long ul = numeric_limits<unsigned long>::max(); + Integer i(ul); + TS_ASSERT(i.getUnsignedLong() == ul); + TS_ASSERT_THROWS_ANYTHING(i.getLong()); + unsigned long ulplus1 = ul + 1; + TS_ASSERT(ulplus1 == 0); + i = i + 1; + TS_ASSERT_THROWS_ANYTHING(i.getUnsignedLong()); + } + void testTestBit() { TS_ASSERT( ! Integer(0).testBit(6) ); TS_ASSERT( ! Integer(0).testBit(5) ); |