diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-07 10:27:21 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:39 -0400 |
commit | d8498372037a4d0c272547ae48046b2182bcd4b1 (patch) | |
tree | ea3f228c5b6b20d71456e47a418e383669925d5f /tests/numerics | |
parent | a71d48881e538630aa1d147d58365da84e6db91f (diff) | |
download | fork-ledger-d8498372037a4d0c272547ae48046b2182bcd4b1.tar.gz fork-ledger-d8498372037a4d0c272547ae48046b2182bcd4b1.tar.bz2 fork-ledger-d8498372037a4d0c272547ae48046b2182bcd4b1.zip |
Major restructuring of the value_t class.
Diffstat (limited to 'tests/numerics')
-rw-r--r-- | tests/numerics/BasicAmount.cc | 3 | ||||
-rw-r--r-- | tests/numerics/CommodityAmount.cc | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/numerics/BasicAmount.cc b/tests/numerics/BasicAmount.cc index f386d8f4..a6772b13 100644 --- a/tests/numerics/BasicAmount.cc +++ b/tests/numerics/BasicAmount.cc @@ -612,7 +612,8 @@ void BasicAmountTestCase::testFractionalConversion() amount_t x1(1234.56); assertEqual(true, bool(x1)); - assertEqual(1234L, x1.to_long()); + assertThrow(x1.to_long(), amount_error); // loses precision + assertEqual(1234L, x1.to_long(true)); assertEqual(1234.56, x1.to_double()); assertEqual(string("1234.56"), x1.to_string()); assertEqual(string("1234.56"), x1.quantity_string()); diff --git a/tests/numerics/CommodityAmount.cc b/tests/numerics/CommodityAmount.cc index 611d2650..cc26bc80 100644 --- a/tests/numerics/CommodityAmount.cc +++ b/tests/numerics/CommodityAmount.cc @@ -466,7 +466,8 @@ void CommodityAmountTestCase::testConversion() amount_t x1("$1234.56"); assertEqual(true, bool(x1)); - assertEqual(1234L, x1.to_long()); + assertThrow(x1.to_long(), amount_error); // loses precision + assertEqual(1234L, x1.to_long(true)); assertEqual(1234.56, x1.to_double()); assertEqual(string("$1234.56"), x1.to_string()); assertEqual(string("1234.56"), x1.quantity_string()); |