summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-18 23:50:25 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:35:37 -0400
commitba2a54f3d22dacd69d8202fc9a7d32a2b40b1d1e (patch)
tree02bfb4221cf9b73bd57cf6df2abae58f3b365c0b /tests
parent4c460a1c40cfb1547ce9a4c91b4e8a87d768463d (diff)
downloadfork-ledger-ba2a54f3d22dacd69d8202fc9a7d32a2b40b1d1e.tar.gz
fork-ledger-ba2a54f3d22dacd69d8202fc9a7d32a2b40b1d1e.tar.bz2
fork-ledger-ba2a54f3d22dacd69d8202fc9a7d32a2b40b1d1e.zip
Initial round of changes to use boost_date_time
Diffstat (limited to 'tests')
-rw-r--r--tests/corelib/numerics/Commodity.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/corelib/numerics/Commodity.cc b/tests/corelib/numerics/Commodity.cc
index 77cdd7b9..b15211f6 100644
--- a/tests/corelib/numerics/Commodity.cc
+++ b/tests/corelib/numerics/Commodity.cc
@@ -15,10 +15,23 @@ void CommodityTestCase::testConstructors()
void CommodityTestCase::testPriceHistory()
{
+ datetime_t jan17_07("2007/01/17 00:00:00");
+ datetime_t feb27_07("2007/02/27 18:00:00");
+ datetime_t feb28_07("2007/02/28 06:00:00");
+ datetime_t feb28_07sbm("2007/02/28 11:59:59");
+ datetime_t mar01_07("2007/03/01 00:00:00");
+ datetime_t apr15_07("2007/04/15 13:00:00");
+
// jww (2007-04-17): tbd
amount_t x1("100.10 AAPL");
- assertEqual(x1, x1.value(datetime_t()));
+ // Commodities cannot be constructed by themselves, since a great
+ // deal of their state depends on how they were seen to be used.
+ commodity_t& aapl(x1.commodity());
+
+ aapl.add_price(datetime_t(), amount_t("$10.20"));
+
+ assertEqual(amount_t("$1021.02"), x1.value(datetime_t()));
assertValid(x1);
}