From b84f676946941df6f7e8476d77d1db0cbe7736c5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Apr 2007 02:14:53 +0000 Subject: Did some optimization and memory cleanup --- tests/corelib/numerics/BasicAmount.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tests/corelib/numerics/BasicAmount.cc') diff --git a/tests/corelib/numerics/BasicAmount.cc b/tests/corelib/numerics/BasicAmount.cc index 972dcbcc..143b8c38 100644 --- a/tests/corelib/numerics/BasicAmount.cc +++ b/tests/corelib/numerics/BasicAmount.cc @@ -5,8 +5,13 @@ using namespace ledger; CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BasicAmountTestCase, "numerics"); -void BasicAmountTestCase::setUp() {} -void BasicAmountTestCase::tearDown() {} +void BasicAmountTestCase::setUp() { + amount_t::initialize(); +} +void BasicAmountTestCase::tearDown() { + amount_t::shutdown(); + assert(live_count.size() == 0); +} void BasicAmountTestCase::testConstructors() { @@ -89,8 +94,8 @@ void BasicAmountTestCase::testAssignment() amount_t x3 = 123.456; amount_t x5 = "123456"; amount_t x6 = "123.456"; - amount_t x7 = std::string("123456"); - amount_t x8 = std::string("123.456"); + amount_t x7 = string("123456"); + amount_t x8 = string("123.456"); amount_t x9 = x3; amount_t x10 = amount_t(x6); @@ -416,8 +421,8 @@ void BasicAmountTestCase::testIntegerConversion() assertEqual(true, bool(x1)); assertEqual(123456L, long(x1)); assertEqual(123456.0, double(x1)); - assertEqual(std::string("123456"), x1.to_string()); - assertEqual(std::string("123456"), x1.quantity_string()); + assertEqual(string("123456"), x1.to_string()); + assertEqual(string("123456"), x1.quantity_string()); CPPUNIT_ASSERT(x1.valid()); } @@ -429,8 +434,8 @@ void BasicAmountTestCase::testFractionalConversion() assertEqual(true, bool(x1)); assertEqual(1234L, long(x1)); assertEqual(1234.56, double(x1)); - assertEqual(std::string("1234.56"), x1.to_string()); - assertEqual(std::string("1234.56"), x1.quantity_string()); + assertEqual(string("1234.56"), x1.to_string()); + assertEqual(string("1234.56"), x1.quantity_string()); CPPUNIT_ASSERT(x1.valid()); } -- cgit v1.2.3