summaryrefslogtreecommitdiff
path: root/test/unit/util/integer_black.h
diff options
context:
space:
mode:
authorChristopher L. Conway <christopherleeconway@gmail.com>2010-05-06 20:08:00 +0000
committerChristopher L. Conway <christopherleeconway@gmail.com>2010-05-06 20:08:00 +0000
commita7e4f9c4af64e669db9df5cd13524b1ab3e47379 (patch)
treeeac6313d811997060c6f1451ca14635633aa9c60 /test/unit/util/integer_black.h
parent1e8c9ae990adc55570298d1ffc5d8c55fbc71237 (diff)
Adding tests for Integer::pow
Diffstat (limited to 'test/unit/util/integer_black.h')
-rw-r--r--test/unit/util/integer_black.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/util/integer_black.h b/test/unit/util/integer_black.h
index c09db2207..8b8faf895 100644
--- a/test/unit/util/integer_black.h
+++ b/test/unit/util/integer_black.h
@@ -273,4 +273,16 @@ public:
TS_ASSERT_EQUALS(res, large.toString());
}
+ void testPow() {
+ TS_ASSERT_EQUALS( Integer(1), Integer(1).pow(0) );
+ TS_ASSERT_EQUALS( Integer(1), Integer(5).pow(0) );
+ TS_ASSERT_EQUALS( Integer(1), Integer(-1).pow(0) );
+ TS_ASSERT_EQUALS( Integer(0), Integer(0).pow(1) );
+ TS_ASSERT_EQUALS( Integer(5), Integer(5).pow(1) );
+ TS_ASSERT_EQUALS( Integer(-5), Integer(-5).pow(1) );
+ TS_ASSERT_EQUALS( Integer(16), Integer(2).pow(4) );
+ TS_ASSERT_EQUALS( Integer(16), Integer(-2).pow(4) );
+ TS_ASSERT_EQUALS( Integer(1000), Integer(10).pow(3) );
+ TS_ASSERT_EQUALS( Integer(-1000), Integer(-10).pow(3) );
+ }
};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback