diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-17 09:11:23 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:35:36 -0400 |
commit | 269a7c6f3bb6f2d8d537c9df6b78ce6a24796678 (patch) | |
tree | 88b55d6200b638667f8e8d2411eb51236ae73400 | |
parent | d650725f373e61bec4e64c1fe2c7189086c8be61 (diff) | |
download | fork-ledger-269a7c6f3bb6f2d8d537c9df6b78ce6a24796678.tar.gz fork-ledger-269a7c6f3bb6f2d8d537c9df6b78ce6a24796678.tar.bz2 fork-ledger-269a7c6f3bb6f2d8d537c9df6b78ce6a24796678.zip |
Got most of the commodity tests working, save multiplication and division.
-rw-r--r-- | amount.cc | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -634,6 +634,13 @@ amount_t& amount_t::operator/=(const amount_t& amt) goto finish; } + if (has_commodity() && amt.has_commodity() && + commodity() != amt.commodity()) + throw new amount_error + (std::string("Dividing amounts with different commodities: ") + + (has_commodity() ? commodity_->qualified_symbol : "NONE") + " != " + + (amt.has_commodity() ? amt.commodity_->qualified_symbol : "NONE")); + _dup(); // Increase the value's precision, to capture fractional parts after |