summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-02-04 04:40:31 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-02-04 04:40:31 -0500
commitc313cee085d97aa0c24ce1491cfc66bd025d32ef (patch)
treea7614ad88e7f6d8d5386dcd3472be225287a2fae /test/unit
parent8c81a1decbb40f62c1b808d4203b0863059769fb (diff)
downloadfork-ledger-c313cee085d97aa0c24ce1491cfc66bd025d32ef.tar.gz
fork-ledger-c313cee085d97aa0c24ce1491cfc66bd025d32ef.tar.bz2
fork-ledger-c313cee085d97aa0c24ce1491cfc66bd025d32ef.zip
Fixed several unit tests
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/t_amount.cc22
-rw-r--r--test/unit/t_balance.cc18
-rw-r--r--test/unit/t_commodity.cc12
3 files changed, 29 insertions, 23 deletions
diff --git a/test/unit/t_amount.cc b/test/unit/t_amount.cc
index cda0a017..07cde8f3 100644
--- a/test/unit/t_amount.cc
+++ b/test/unit/t_amount.cc
@@ -13,20 +13,20 @@ using namespace ledger;
struct amount_fixture {
amount_fixture() {
- times_initialize();
- amount_t::initialize();
+ times_initialize();
+ amount_t::initialize();
- // Cause the display precision for dollars to be initialized to 2.
- amount_t x1("$1.00");
- BOOST_CHECK(x1);
+ // Cause the display precision for dollars to be initialized to 2.
+ amount_t x1("$1.00");
+ BOOST_CHECK(x1);
- amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
+ amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
}
~amount_fixture() {
- amount_t::stream_fullstrings = false;
- amount_t::shutdown();
- times_shutdown();
+ amount_t::stream_fullstrings = false;
+ amount_t::shutdown();
+ times_shutdown();
}
};
@@ -460,10 +460,14 @@ BOOST_AUTO_TEST_CASE(testCommodityComparisons)
BOOST_CHECK(x3 <= x5);
BOOST_CHECK(x3 < x5);
BOOST_CHECK(x3 <= x5);
+#ifndef NOT_FOR_PYTHON
BOOST_CHECK(! (x3 == x5));
+#endif
BOOST_CHECK(x3 < x1);
BOOST_CHECK(x3 < x4);
+#ifndef NOT_FOR_PYTHON
BOOST_CHECK(! (x6 == x7));
+#endif
BOOST_CHECK_THROW(x6 < x7, amount_error);
BOOST_CHECK(x1.valid());
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index b74a54e7..0d681a88 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -10,21 +10,21 @@ using namespace ledger;
struct balance_fixture {
balance_fixture() {
- times_initialize();
- amount_t::initialize();
+ times_initialize();
+ amount_t::initialize();
- // Cause the display precision for dollars to be initialized to 2.
- amount_t x1("$1.00");
- BOOST_CHECK(x1);
+ // Cause the display precision for dollars to be initialized to 2.
+ amount_t x1("$1.00");
+ BOOST_CHECK(x1);
- amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
+ amount_t::stream_fullstrings = true; // make reports from UnitTests accurate
}
~balance_fixture()
{
- amount_t::stream_fullstrings = false;
- amount_t::shutdown();
- times_shutdown();
+ amount_t::stream_fullstrings = false;
+ amount_t::shutdown();
+ times_shutdown();
}
};
diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc
index 7f797117..dc64dcfb 100644
--- a/test/unit/t_commodity.cc
+++ b/test/unit/t_commodity.cc
@@ -11,14 +11,14 @@ using namespace ledger;
struct commodity_fixture {
commodity_fixture() {
- times_initialize();
- amount_t::initialize();
- amount_t::stream_fullstrings = true;
+ times_initialize();
+ amount_t::initialize();
+ amount_t::stream_fullstrings = true;
}
~commodity_fixture() {
- amount_t::shutdown();
- times_shutdown();
+ amount_t::shutdown();
+ times_shutdown();
}
};
@@ -50,7 +50,9 @@ BOOST_AUTO_TEST_CASE(testPriceHistory)
amount_t x1("100.10 AAPL");
BOOST_CHECK_THROW(x0.value(), amount_error);
+#ifndef NOT_FOR_PYTHON
BOOST_CHECK(! x1.value());
+#endif
// Commodities cannot be constructed by themselves, since a great deal
// of their state depends on how they were seen to be used.