diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-27 10:08:42 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:31 -0400 |
commit | 0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f (patch) | |
tree | 750d64f6817282a6f4744058f73164a2996f6b03 /tests | |
parent | d01629148383261d7944e91fd2ac67b334a6834d (diff) | |
download | fork-ledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.tar.gz fork-ledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.tar.bz2 fork-ledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.zip |
Restructured the code to use the new utility code in utils.h.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/corelib/numerics/BasicAmount.cc | 4 | ||||
-rw-r--r-- | tests/corelib/numerics/Commodity.cc | 4 | ||||
-rw-r--r-- | tests/corelib/numerics/CommodityAmount.cc | 46 |
3 files changed, 27 insertions, 27 deletions
diff --git a/tests/corelib/numerics/BasicAmount.cc b/tests/corelib/numerics/BasicAmount.cc index fbab8877..90cf26ec 100644 --- a/tests/corelib/numerics/BasicAmount.cc +++ b/tests/corelib/numerics/BasicAmount.cc @@ -339,7 +339,7 @@ void BasicAmountTestCase::testIntegerDivision() amount_t x1(123L); amount_t y1(456L); - assertThrow(x1 / 0L, amount_error *); + assertThrow(x1 / 0L, amount_exception); assertEqual(amount_t(0L), amount_t(0L) / x1); assertEqual(amount_t(0L), 0L / x1); assertEqual(x1, x1 / 1L); @@ -376,7 +376,7 @@ void BasicAmountTestCase::testFractionalDivision() amount_t x1(123.123); amount_t y1(456.456); - assertThrow(x1 / 0L, amount_error *); + assertThrow(x1 / 0L, amount_exception); assertEqual(amount_t("0.008121959"), amount_t(1.0) / x1); assertEqual(amount_t("0.008121959"), 1.0 / x1); assertEqual(x1, x1 / 1.0); diff --git a/tests/corelib/numerics/Commodity.cc b/tests/corelib/numerics/Commodity.cc index e43ee7b7..e7e2a18c 100644 --- a/tests/corelib/numerics/Commodity.cc +++ b/tests/corelib/numerics/Commodity.cc @@ -3,10 +3,10 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CommodityTestCase, "numerics"); void CommodityTestCase::setUp() { - amount_t::initialize(); + ledger::initialize(); } void CommodityTestCase::tearDown() { - amount_t::shutdown(); + ledger::shutdown(); } void CommodityTestCase::testPriceHistory() diff --git a/tests/corelib/numerics/CommodityAmount.cc b/tests/corelib/numerics/CommodityAmount.cc index afdbe89e..7ed7f403 100644 --- a/tests/corelib/numerics/CommodityAmount.cc +++ b/tests/corelib/numerics/CommodityAmount.cc @@ -6,7 +6,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CommodityAmountTestCase, "numerics"); void CommodityAmountTestCase::setUp() { - amount_t::initialize(); + ledger::initialize(); // Cause the display precision for dollars to be initialized to 2. amount_t x1("$1.00"); @@ -17,7 +17,7 @@ void CommodityAmountTestCase::setUp() void CommodityAmountTestCase::tearDown() { amount_t::full_strings = false; - amount_t::shutdown(); + ledger::shutdown(); } void CommodityAmountTestCase::testConstructors() @@ -232,13 +232,13 @@ void CommodityAmountTestCase::testAddition() assertEqual(string("$246.90"), (x1 + x1).to_string()); assertEqual(string("$246.91"), (x1 + x2).to_string()); - assertThrow(x1 + x0, amount_error *); - assertThrow(x1 + x3, amount_error *); - assertThrow(x1 + x4, amount_error *); - assertThrow(x1 + x5, amount_error *); - assertThrow(x1 + x6, amount_error *); - assertThrow(x1 + 123.45, amount_error *); - assertThrow(x1 + 123L, amount_error *); + assertThrow(x1 + x0, amount_exception); + assertThrow(x1 + x3, amount_exception); + assertThrow(x1 + x4, amount_exception); + assertThrow(x1 + x5, amount_exception); + assertThrow(x1 + x6, amount_exception); + assertThrow(x1 + 123.45, amount_exception); + assertThrow(x1 + 123L, amount_exception); assertEqual(amount_t("DM 246.90"), x3 + x3); assertEqual(amount_t("246.90 euro"), x4 + x4); @@ -290,13 +290,13 @@ void CommodityAmountTestCase::testSubtraction() assertEqual(string("$0.00"), (x1 - x1).to_string()); assertEqual(string("$-0.01"), (x1 - x2).to_string()); - assertThrow(x1 - x0, amount_error *); - assertThrow(x1 - x3, amount_error *); - assertThrow(x1 - x4, amount_error *); - assertThrow(x1 - x5, amount_error *); - assertThrow(x1 - x6, amount_error *); - assertThrow(x1 - 123.45, amount_error *); - assertThrow(x1 - 123L, amount_error *); + assertThrow(x1 - x0, amount_exception); + assertThrow(x1 - x3, amount_exception); + assertThrow(x1 - x4, amount_exception); + assertThrow(x1 - x5, amount_exception); + assertThrow(x1 - x6, amount_exception); + assertThrow(x1 - 123.45, amount_exception); + assertThrow(x1 - 123L, amount_exception); assertEqual(amount_t("DM 0.00"), x3 - x3); assertEqual(amount_t("DM 23.45"), x3 - amount_t("DM 100.00")); @@ -374,9 +374,9 @@ void CommodityAmountTestCase::testMultiplication() assertEqual(string("$15200.00"), (x1 * x2).to_string()); assertEqual(string("$15199.99986168"), (x2 * x1).to_string()); - assertThrow(x1 * x3, amount_error *); - assertThrow(x1 * x4, amount_error *); - assertThrow(x1 * x5, amount_error *); + assertThrow(x1 * x3, amount_exception); + assertThrow(x1 * x4, amount_exception); + assertThrow(x1 * x5, amount_exception); x1 *= amount_t("123.12"); assertEqual(internalAmount("$15158.5344"), x1); @@ -410,7 +410,7 @@ void CommodityAmountTestCase::testDivision() amount_t x4("123.45 euro"); amount_t x5("123.45€"); - assertThrow(x1 / 0L, amount_error *); + assertThrow(x1 / 0L, amount_exception); assertEqual(amount_t("$0.00"), 0L / x1); assertEqual(x1, x1 / 1L); assertEqual(internalAmount("$0.00812216"), 1L / x1); @@ -428,9 +428,9 @@ void CommodityAmountTestCase::testDivision() assertEqual(string("$1.00"), (x1 / x2).to_string()); assertEqual(string("$1.00273545321637426901"), (x2 / x1).to_string()); - assertThrow(x1 / x3, amount_error *); - assertThrow(x1 / x4, amount_error *); - assertThrow(x1 / x5, amount_error *); + assertThrow(x1 / x3, amount_exception); + assertThrow(x1 / x4, amount_exception); + assertThrow(x1 / x5, amount_exception); x1 /= amount_t("123.12"); assertEqual(internalAmount("$1.00"), x1); |