summaryrefslogtreecommitdiff
path: root/tests/corelib/numerics/CommodityAmount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-19 20:31:46 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:28 -0400
commit0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (patch)
tree0a2c2aca7100d045f491b03f0a5bda92378d3ef9 /tests/corelib/numerics/CommodityAmount.cc
parent176b3044e355398a0c31e0c42a3cd7b8a2e3f3e5 (diff)
downloadfork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.gz
fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.bz2
fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.zip
Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the command sequence); and added smart XML semantics to the XPath implementation so that nodes can be coerced to values.
Diffstat (limited to 'tests/corelib/numerics/CommodityAmount.cc')
-rw-r--r--tests/corelib/numerics/CommodityAmount.cc30
1 files changed, 9 insertions, 21 deletions
diff --git a/tests/corelib/numerics/CommodityAmount.cc b/tests/corelib/numerics/CommodityAmount.cc
index c41b33d4..860e7b1c 100644
--- a/tests/corelib/numerics/CommodityAmount.cc
+++ b/tests/corelib/numerics/CommodityAmount.cc
@@ -91,9 +91,9 @@ void CommodityAmountTestCase::testNegation()
assertEqual(amount_t("-123.45€"), - x9);
assertEqual(amount_t("123.45€"), - x10);
- assertEqual(amount_t("$-123.45"), x1.negated());
- assertEqual(amount_t("$123.45"), x2.negated());
- assertEqual(amount_t("$123.45"), x3.negated());
+ assertEqual(amount_t("$-123.45"), x1.negate());
+ assertEqual(amount_t("$123.45"), x2.negate());
+ assertEqual(amount_t("$123.45"), x3.negate());
assertEqual(std::string("$-123.45"), (- x1).to_string());
assertEqual(std::string("$123.45"), (- x2).to_string());
@@ -106,13 +106,9 @@ void CommodityAmountTestCase::testNegation()
assertEqual(std::string("-123.45€"), (- x9).to_string());
assertEqual(std::string("123.45€"), (- x10).to_string());
- x1.negate();
- x2.negate();
- x3.negate();
-
- assertEqual(amount_t("$-123.45"), x1);
- assertEqual(amount_t("$123.45"), x2);
- assertEqual(amount_t("$123.45"), x3);
+ assertEqual(amount_t("$-123.45"), x1.negate());
+ assertEqual(amount_t("$123.45"), x2.negate());
+ assertEqual(amount_t("$123.45"), x3.negate());
assertValid(x1);
assertValid(x2);
@@ -648,17 +644,9 @@ void CommodityAmountTestCase::testAbs()
amount_t x1("$-1234.56");
amount_t x2("$1234.56");
- assertEqual(amount_t(), abs(x0));
- assertEqual(amount_t("$1234.56"), abs(x1));
- assertEqual(amount_t("$1234.56"), abs(x2));
-
- x0.abs();
- x1.abs();
- x2.abs();
-
- assertEqual(amount_t(), x0);
- assertEqual(amount_t("$1234.56"), x1);
- assertEqual(amount_t("$1234.56"), x2);
+ assertEqual(amount_t(), x0.abs());
+ assertEqual(amount_t("$1234.56"), x1.abs());
+ assertEqual(amount_t("$1234.56"), x2.abs());
assertValid(x0);
assertValid(x1);