summaryrefslogtreecommitdiff
path: root/test/unit/t_amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-25 23:40:15 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-25 23:40:15 -0400
commit55a6d588ff26aee98e0bde2f3dc71b626e11c048 (patch)
tree47678ecdc49855e292f3bad90ded9c13ff7dfd1d /test/unit/t_amount.cc
parent7f37d7edcce60017d7132d47972c9943bb43eb4d (diff)
downloadfork-ledger-55a6d588ff26aee98e0bde2f3dc71b626e11c048.tar.gz
fork-ledger-55a6d588ff26aee98e0bde2f3dc71b626e11c048.tar.bz2
fork-ledger-55a6d588ff26aee98e0bde2f3dc71b626e11c048.zip
Allow uncommoditized amounts to +/- with an amount
Thus, you can say "$100 + 10" to increase it by $10.
Diffstat (limited to 'test/unit/t_amount.cc')
-rw-r--r--test/unit/t_amount.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/unit/t_amount.cc b/test/unit/t_amount.cc
index 5e673e7c..7f0ae669 100644
--- a/test/unit/t_amount.cc
+++ b/test/unit/t_amount.cc
@@ -540,11 +540,11 @@ void AmountTestCase::testCommodityAddition()
assertThrow(x1 + x3, amount_error);
assertThrow(x1 + x4, amount_error);
assertThrow(x1 + x5, amount_error);
- assertThrow(x1 + x6, amount_error);
+ assertEqual(string("$246.90"), (x1 + x6).to_string());
#ifndef NOT_FOR_PYTHON
- assertThrow(x1 + 123.45, amount_error);
+ assertEqual(string("$246.90"), (x1 + 123.45).to_string());
#endif // NOT_FOR_PYTHON
- assertThrow(x1 + 123L, amount_error);
+ assertEqual(string("$246.45"), (x1 + 123L).to_string());
assertEqual(amount_t("DM 246.90"), x3 + x3);
assertEqual(amount_t("246.90 euro"), x4 + x4);
@@ -656,11 +656,11 @@ void AmountTestCase::testCommoditySubtraction()
assertThrow(x1 - x3, amount_error);
assertThrow(x1 - x4, amount_error);
assertThrow(x1 - x5, amount_error);
- assertThrow(x1 - x6, amount_error);
+ assertEqual(string("$0.00"), (x1 - x6).to_string());
#ifndef NOT_FOR_PYTHON
- assertThrow(x1 - 123.45, amount_error);
+ assertEqual(string("$-0.00"), (x1 - 123.45).to_string());
#endif // NOT_FOR_PYTHON
- assertThrow(x1 - 123L, amount_error);
+ assertEqual(string("$0.45"), (x1 - 123L).to_string());
assertEqual(amount_t("DM 0.00"), x3 - x3);
assertEqual(amount_t("DM 23.45"), x3 - amount_t("DM 100.00"));