diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/numerics/BasicAmount.cc | 20 | ||||
-rw-r--r-- | tests/numerics/BasicAmount.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/numerics/BasicAmount.cc b/tests/numerics/BasicAmount.cc index bcc5c2b5..6ce39d1d 100644 --- a/tests/numerics/BasicAmount.cc +++ b/tests/numerics/BasicAmount.cc @@ -600,6 +600,26 @@ void BasicAmountTestCase::testAbs() CPPUNIT_ASSERT(x2.valid()); } +void BasicAmountTestCase::testReduction() +{ + amount_t x1("60s"); + amount_t x2("600s"); + amount_t x3("6000s"); + amount_t x4("360000s"); + amount_t x5("10m"); // 600s + amount_t x6("100m"); // 6000s + amount_t x7("1000m"); // 60000s + amount_t x8("10000m"); // 600000s + amount_t x9("10h"); // 36000s + amount_t x10("100h"); // 360000s + amount_t x11("1000h"); // 3600000s + amount_t x12("10000h"); // 36000000s + + assertEqual(x2, x5); + assertEqual(x3, x6); + assertEqual(x4, x10); +} + void BasicAmountTestCase::testPrinting() { amount_t x0; diff --git a/tests/numerics/BasicAmount.h b/tests/numerics/BasicAmount.h index 2c107f45..a6c8aff7 100644 --- a/tests/numerics/BasicAmount.h +++ b/tests/numerics/BasicAmount.h @@ -27,6 +27,7 @@ class BasicAmountTestCase : public CPPUNIT_NS::TestCase CPPUNIT_TEST(testComparisons); CPPUNIT_TEST(testSign); CPPUNIT_TEST(testAbs); + CPPUNIT_TEST(testReduction); CPPUNIT_TEST(testPrinting); CPPUNIT_TEST_SUITE_END(); @@ -58,6 +59,7 @@ public: void testComparisons(); void testSign(); void testAbs(); + void testReduction(); void testPrinting(); private: |