Got most of the commodity tests working, save multiplication and division.
This commit is contained in:
parent
d650725f37
commit
269a7c6f3b
1 changed files with 7 additions and 0 deletions
|
|
@ -634,6 +634,13 @@ amount_t& amount_t::operator/=(const amount_t& amt)
|
||||||
goto finish;
|
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();
|
_dup();
|
||||||
|
|
||||||
// Increase the value's precision, to capture fractional parts after
|
// Increase the value's precision, to capture fractional parts after
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue