summaryrefslogtreecommitdiff
path: root/test/unit/t_commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-19 20:05:18 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-19 20:05:18 -0400
commit49b83c0d6ff026b4c041eb451f24cca8756e540a (patch)
treeb3e7fc7c5e87dcabfa1a9ec7c2c51e866adb6a16 /test/unit/t_commodity.cc
parent52e140d14e36617f5fea13f62195820ea428fcb5 (diff)
downloadfork-ledger-49b83c0d6ff026b4c041eb451f24cca8756e540a.tar.gz
fork-ledger-49b83c0d6ff026b4c041eb451f24cca8756e540a.tar.bz2
fork-ledger-49b83c0d6ff026b4c041eb451f24cca8756e540a.zip
Further extended commodities unit test.
Diffstat (limited to 'test/unit/t_commodity.cc')
-rw-r--r--test/unit/t_commodity.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc
index a3973915..925b2cee 100644
--- a/test/unit/t_commodity.cc
+++ b/test/unit/t_commodity.cc
@@ -36,7 +36,7 @@ void CommodityTestCase::testPriceHistory()
aapl.add_price(feb28_07sbm, amount_t("$18.30"));
aapl.add_price(mar01_07, amount_t("$19.50"));
aapl.add_price(apr15_07, amount_t("$21.22"));
- aapl.add_price(apr15_07, amount_t("EUR 23.00"));
+ aapl.add_price(jan17_05, amount_t("EUR 23.00"));
aapl.add_price(jan17_06, amount_t("CAD 25.00"));
commodity_t& euro(amount_t("EUR 1.00").commodity());
@@ -58,6 +58,13 @@ void CommodityTestCase::testPriceHistory()
amt = x1.value(current_time, euro);
assertTrue(amt);
+ assertEqual(amount_t("EUR 1366.87"), *amt);
+
+ // 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);
amt = x1.value(current_time, cad);