summaryrefslogtreecommitdiff
path: root/test/unit/t_commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-31 04:25:05 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-31 04:25:05 -0400
commite9ff5caa13e2d60681010dbedcf56459ee7521a4 (patch)
tree056a124c232daccb3dcc616a32fb3b2a9c217d86 /test/unit/t_commodity.cc
parentc96ab6cb0fb289cd50fb239ba44c01aba131fc18 (diff)
downloadfork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.tar.gz
fork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.tar.bz2
fork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.zip
Rationals based math is now passing the unit tests.
Diffstat (limited to 'test/unit/t_commodity.cc')
-rw-r--r--test/unit/t_commodity.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc
index 81538e76..9818c863 100644
--- a/test/unit/t_commodity.cc
+++ b/test/unit/t_commodity.cc
@@ -75,22 +75,27 @@ void CommodityTestCase::testPriceHistory()
amt = x1.value(current_time);
assertTrue(amt);
- assertEqual(amount_t("$2124.12"), *amt);
+ assertEqual(string("$2124.12"), amt->to_string());
+#ifdef INTEGER_MATH
+ assertEqual(string("$2124.12"), amt->to_fullstring());
+#else
+ assertEqual(string("$2124.1220"), amt->to_fullstring());
+#endif
amt = x1.value(current_time, euro);
assertTrue(amt);
- assertEqual(amount_t("EUR 1366.87"), *amt);
+ assertEqual(string("EUR 1366.87"), amt->rounded().to_string());
// Add a newer Euro pricing
aapl.add_price(jan17_07, amount_t("EUR 23.00"));
amt = x1.value(current_time, euro);
assertTrue(amt);
- assertEqual(amount_t("EUR 2302.30"), *amt);
+ assertEqual(string("EUR 2302.30"), amt->to_string());
amt = x1.value(current_time, cad);
assertTrue(amt);
- assertEqual(amount_t("CAD 3223.22"), *amt);
+ assertEqual(string("CAD 3223.22"), amt->to_string());
#endif // NOT_FOR_PYTHON
assertValid(x1);