summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-07 11:37:15 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:40 -0400
commit30978b7fe5ee93413b2e05b54942f6550832b222 (patch)
treecede95552b56e9f17b24b6daa1037e7b87f11aed /tests
parenta99695f69b395c9664447b5af82893fb755bd4c0 (diff)
downloadfork-ledger-30978b7fe5ee93413b2e05b54942f6550832b222.tar.gz
fork-ledger-30978b7fe5ee93413b2e05b54942f6550832b222.tar.bz2
fork-ledger-30978b7fe5ee93413b2e05b54942f6550832b222.zip
Added new test files.
Diffstat (limited to 'tests')
-rw-r--r--tests/UnitTests.h2
-rw-r--r--tests/numerics/t_amount.cc5
-rw-r--r--tests/numerics/t_balance.cc25
-rw-r--r--tests/numerics/t_balance.h30
-rw-r--r--tests/utility/t_times.cc (renamed from tests/numerics/t_times.cc)2
-rw-r--r--tests/utility/t_times.h (renamed from tests/numerics/t_times.h)0
-rw-r--r--tests/utility/t_utils.cc10
-rw-r--r--tests/utility/t_utils.h28
8 files changed, 98 insertions, 4 deletions
diff --git a/tests/UnitTests.h b/tests/UnitTests.h
index 5edfb5d3..e7027cf4 100644
--- a/tests/UnitTests.h
+++ b/tests/UnitTests.h
@@ -19,4 +19,6 @@ using namespace ledger;
#define assertMessage(x,y) CPPUNIT_ASSERT_MESSAGE(x,y)
#define assertThrow(x,y) CPPUNIT_ASSERT_THROW(x,y)
+#define internalAmount(x) amount_t::exact(x)
+
#endif /* _UNITTESTS_H */
diff --git a/tests/numerics/t_amount.cc b/tests/numerics/t_amount.cc
index 67ea1781..a59ff2ea 100644
--- a/tests/numerics/t_amount.cc
+++ b/tests/numerics/t_amount.cc
@@ -1,7 +1,5 @@
#include "t_amount.h"
-#define internalAmount(x) amount_t::exact(x)
-
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AmountTestCase, "numerics");
void AmountTestCase::setUp()
@@ -11,7 +9,8 @@ void AmountTestCase::setUp()
// Cause the display precision for dollars to be initialized to 2.
amount_t x1("$1.00");
assertTrue(x1);
- amount_t::stream_fullstrings = true; // makes error reports from UnitTests accurate
+
+ amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
}
void AmountTestCase::tearDown()
diff --git a/tests/numerics/t_balance.cc b/tests/numerics/t_balance.cc
new file mode 100644
index 00000000..ca759836
--- /dev/null
+++ b/tests/numerics/t_balance.cc
@@ -0,0 +1,25 @@
+#include "t_balance.h"
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BalanceTestCase, "numerics");
+
+void BalanceTestCase::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 BalanceTestCase::tearDown()
+{
+ amount_t::stream_fullstrings = false;
+
+ ledger::set_session_context();
+}
+
+void BalanceTestCase::testConstructors()
+{
+}
diff --git a/tests/numerics/t_balance.h b/tests/numerics/t_balance.h
new file mode 100644
index 00000000..7c27f7e8
--- /dev/null
+++ b/tests/numerics/t_balance.h
@@ -0,0 +1,30 @@
+#ifndef _T_BALANCE_H
+#define _T_BALANCE_H
+
+#include "UnitTests.h"
+
+class BalanceTestCase : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BalanceTestCase);
+
+ CPPUNIT_TEST(testConstructors);
+
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ ledger::session_t session;
+
+ BalanceTestCase() {}
+ virtual ~BalanceTestCase() {}
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testConstructors();
+
+private:
+ BalanceTestCase(const BalanceTestCase &copy);
+ void operator=(const BalanceTestCase &copy);
+};
+
+#endif // _T_BALANCE_H
diff --git a/tests/numerics/t_times.cc b/tests/utility/t_times.cc
index 0d89d03f..c2d6fe64 100644
--- a/tests/numerics/t_times.cc
+++ b/tests/utility/t_times.cc
@@ -1,6 +1,6 @@
#include "t_times.h"
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(DateTimeTestCase, "numerics");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(DateTimeTestCase, "utility");
void DateTimeTestCase::setUp() {}
void DateTimeTestCase::tearDown() {}
diff --git a/tests/numerics/t_times.h b/tests/utility/t_times.h
index 5bbadf21..5bbadf21 100644
--- a/tests/numerics/t_times.h
+++ b/tests/utility/t_times.h
diff --git a/tests/utility/t_utils.cc b/tests/utility/t_utils.cc
new file mode 100644
index 00000000..eda84a3a
--- /dev/null
+++ b/tests/utility/t_utils.cc
@@ -0,0 +1,10 @@
+#include "t_utils.h"
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UtilitiesTestCase, "utility");
+
+void UtilitiesTestCase::setUp() {}
+void UtilitiesTestCase::tearDown() {}
+
+void UtilitiesTestCase::testConstructors()
+{
+}
diff --git a/tests/utility/t_utils.h b/tests/utility/t_utils.h
new file mode 100644
index 00000000..97154bae
--- /dev/null
+++ b/tests/utility/t_utils.h
@@ -0,0 +1,28 @@
+#ifndef _T_UTILS_H
+#define _T_UTILS_H
+
+#include "UnitTests.h"
+
+class UtilitiesTestCase : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(UtilitiesTestCase);
+
+ CPPUNIT_TEST(testConstructors);
+
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ UtilitiesTestCase() {}
+ virtual ~UtilitiesTestCase() {}
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void testConstructors();
+
+private:
+ UtilitiesTestCase(const UtilitiesTestCase &copy);
+ void operator=(const UtilitiesTestCase &copy);
+};
+
+#endif /* _T_UTILS_H */