summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-25 01:10:05 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-25 01:10:05 -0400
commit79a79766000a6440f651af50cfac3646171e8f0a (patch)
tree1b5a9a419ffd65770fd36ec55f9c0a608e5b1045 /test/unit
parent1ae1033090faf566f8577cc63ac10a2d4e0e1f7f (diff)
downloadfork-ledger-79a79766000a6440f651af50cfac3646171e8f0a.tar.gz
fork-ledger-79a79766000a6440f651af50cfac3646171e8f0a.tar.bz2
fork-ledger-79a79766000a6440f651af50cfac3646171e8f0a.zip
Reorganized Ledger so that it builds as 7 separate libraries. This is mainly
to prove to myself that it has proper decoupling between prior code areas.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/t_amount.cc12
-rw-r--r--test/unit/t_amount.h2
-rw-r--r--test/unit/t_balance.cc12
-rw-r--r--test/unit/t_balance.h2
-rw-r--r--test/unit/t_commodity.cc12
-rw-r--r--test/unit/t_commodity.h2
-rw-r--r--test/unit/t_expr.cc20
-rw-r--r--test/unit/t_expr.h2
-rw-r--r--test/unit/t_times.cc2
-rw-r--r--test/unit/t_utils.cc2
-rw-r--r--test/unit/t_valexpr.cc25
-rw-r--r--test/unit/t_valexpr.h30
12 files changed, 36 insertions, 87 deletions
diff --git a/test/unit/t_amount.cc b/test/unit/t_amount.cc
index 6fd78fa6..c95384a8 100644
--- a/test/unit/t_amount.cc
+++ b/test/unit/t_amount.cc
@@ -1,10 +1,15 @@
#include "t_amount.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AmountTestCase, "numerics");
+#include "utils.h"
+#include "amount.h"
+
+using namespace ledger;
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AmountTestCase, "math");
void AmountTestCase::setUp()
{
- ledger::set_session_context(&session);
+ amount_t::initialize();
// Cause the display precision for dollars to be initialized to 2.
amount_t x1("$1.00");
@@ -16,8 +21,7 @@ void AmountTestCase::setUp()
void AmountTestCase::tearDown()
{
amount_t::stream_fullstrings = false;
-
- ledger::set_session_context();
+ amount_t::shutdown();
}
void AmountTestCase::testParser()
diff --git a/test/unit/t_amount.h b/test/unit/t_amount.h
index 2d5a327a..a8310673 100644
--- a/test/unit/t_amount.h
+++ b/test/unit/t_amount.h
@@ -52,8 +52,6 @@ class AmountTestCase : public CPPUNIT_NS::TestCase
CPPUNIT_TEST_SUITE_END();
public:
- ledger::session_t session;
-
AmountTestCase() {}
virtual ~AmountTestCase() {}
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index ca759836..93d97d6a 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -1,10 +1,15 @@
#include "t_balance.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BalanceTestCase, "numerics");
+#include "utils.h"
+#include "amount.h"
+
+using namespace ledger;
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BalanceTestCase, "math");
void BalanceTestCase::setUp()
{
- ledger::set_session_context(&session);
+ amount_t::initialize();
// Cause the display precision for dollars to be initialized to 2.
amount_t x1("$1.00");
@@ -16,8 +21,7 @@ void BalanceTestCase::setUp()
void BalanceTestCase::tearDown()
{
amount_t::stream_fullstrings = false;
-
- ledger::set_session_context();
+ amount_t::shutdown();
}
void BalanceTestCase::testConstructors()
diff --git a/test/unit/t_balance.h b/test/unit/t_balance.h
index 7c27f7e8..fea68b8a 100644
--- a/test/unit/t_balance.h
+++ b/test/unit/t_balance.h
@@ -12,8 +12,6 @@ class BalanceTestCase : public CPPUNIT_NS::TestCase
CPPUNIT_TEST_SUITE_END();
public:
- ledger::session_t session;
-
BalanceTestCase() {}
virtual ~BalanceTestCase() {}
diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc
index 925b2cee..62ec557e 100644
--- a/test/unit/t_commodity.cc
+++ b/test/unit/t_commodity.cc
@@ -1,12 +1,18 @@
#include "t_commodity.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CommodityTestCase, "numerics");
+#include "utils.h"
+#include "amount.h"
+
+using namespace ledger;
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CommodityTestCase, "math");
void CommodityTestCase::setUp() {
- ledger::set_session_context(&session);
+ amount_t::initialize();
}
+
void CommodityTestCase::tearDown() {
- ledger::set_session_context();
+ amount_t::shutdown();
}
void CommodityTestCase::testPriceHistory()
diff --git a/test/unit/t_commodity.h b/test/unit/t_commodity.h
index ed739751..67903628 100644
--- a/test/unit/t_commodity.h
+++ b/test/unit/t_commodity.h
@@ -15,8 +15,6 @@ class CommodityTestCase : public CPPUNIT_NS::TestCase
CPPUNIT_TEST_SUITE_END();
public:
- ledger::session_t session;
-
CommodityTestCase() {}
virtual ~CommodityTestCase() {}
diff --git a/test/unit/t_expr.cc b/test/unit/t_expr.cc
index 58a60e23..a6655f6a 100644
--- a/test/unit/t_expr.cc
+++ b/test/unit/t_expr.cc
@@ -1,23 +1,21 @@
#include "t_expr.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ValueExprTestCase, "numerics");
+#include "expr.h"
-void ValueExprTestCase::setUp()
-{
- ledger::set_session_context(&session);
+using namespace ledger;
- // Cause the display precision for dollars to be initialized to 2.
- amount_t x1("$1.00");
- assertTrue(x1);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ValueExprTestCase, "expr");
- amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
+void ValueExprTestCase::setUp()
+{
+ amount_t::initialize();
+ expr_t::initialize();
}
void ValueExprTestCase::tearDown()
{
- amount_t::stream_fullstrings = false;
-
- ledger::set_session_context();
+ expr_t::shutdown();
+ amount_t::shutdown();
}
void ValueExprTestCase::testConstructors()
diff --git a/test/unit/t_expr.h b/test/unit/t_expr.h
index bb03ba56..50813ea3 100644
--- a/test/unit/t_expr.h
+++ b/test/unit/t_expr.h
@@ -12,8 +12,6 @@ class ValueExprTestCase : public CPPUNIT_NS::TestCase
CPPUNIT_TEST_SUITE_END();
public:
- ledger::session_t session;
-
ValueExprTestCase() {}
virtual ~ValueExprTestCase() {}
diff --git a/test/unit/t_times.cc b/test/unit/t_times.cc
index 05fd34ce..7f35bf50 100644
--- a/test/unit/t_times.cc
+++ b/test/unit/t_times.cc
@@ -1,6 +1,6 @@
#include "t_times.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(DateTimeTestCase, "utility");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(DateTimeTestCase, "util");
void DateTimeTestCase::setUp() {}
void DateTimeTestCase::tearDown() {}
diff --git a/test/unit/t_utils.cc b/test/unit/t_utils.cc
index eda84a3a..57c2a5d4 100644
--- a/test/unit/t_utils.cc
+++ b/test/unit/t_utils.cc
@@ -1,6 +1,6 @@
#include "t_utils.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UtilitiesTestCase, "utility");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UtilitiesTestCase, "util");
void UtilitiesTestCase::setUp() {}
void UtilitiesTestCase::tearDown() {}
diff --git a/test/unit/t_valexpr.cc b/test/unit/t_valexpr.cc
deleted file mode 100644
index 026b4eec..00000000
--- a/test/unit/t_valexpr.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "t_valexpr.h"
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ValueExprTestCase, "numerics");
-
-void ValueExprTestCase::setUp()
-{
- ledger::set_session_context(&session);
-
- // Cause the display precision for dollars to be initialized to 2.
- amount_t x1("$1.00");
- assertTrue(x1);
-
- amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
-}
-
-void ValueExprTestCase::tearDown()
-{
- amount_t::stream_fullstrings = false;
-
- ledger::set_session_context();
-}
-
-void ValueExprTestCase::testConstructors()
-{
-}
diff --git a/test/unit/t_valexpr.h b/test/unit/t_valexpr.h
deleted file mode 100644
index 3cac4ed6..00000000
--- a/test/unit/t_valexpr.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _T_VALEXPR_H
-#define _T_VALEXPR_H
-
-#include "UnitTests.h"
-
-class ValueExprTestCase : public CPPUNIT_NS::TestCase
-{
- CPPUNIT_TEST_SUITE(ValueExprTestCase);
-
- CPPUNIT_TEST(testConstructors);
-
- CPPUNIT_TEST_SUITE_END();
-
-public:
- ledger::session_t session;
-
- ValueExprTestCase() {}
- virtual ~ValueExprTestCase() {}
-
- virtual void setUp();
- virtual void tearDown();
-
- void testConstructors();
-
-private:
- ValueExprTestCase(const ValueExprTestCase &copy);
- void operator=(const ValueExprTestCase &copy);
-};
-
-#endif // _T_VALEXPR_H