summaryrefslogtreecommitdiff
path: root/tests/numerics
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-02 03:05:23 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:35 -0400
commitde64861182dfc9b3deaaf95846997986bca41cd9 (patch)
treea94a4428874781a03c2810156bc2652064fa50b8 /tests/numerics
parent103881ff80008b09608550de5b72b91509eb9fff (diff)
downloadfork-ledger-de64861182dfc9b3deaaf95846997986bca41cd9.tar.gz
fork-ledger-de64861182dfc9b3deaaf95846997986bca41cd9.tar.bz2
fork-ledger-de64861182dfc9b3deaaf95846997986bca41cd9.zip
Added much documentation to amount.h
Diffstat (limited to 'tests/numerics')
-rw-r--r--tests/numerics/BasicAmount.cc20
-rw-r--r--tests/numerics/BasicAmount.h2
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: