summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authortripun <tripun@gmail.com>2014-08-11 02:46:01 +0530
committertripun <tripun@gmail.com>2014-08-11 21:01:26 +0530
commit84b9ca73aac73b6c7938abea91f8f550a0fad101 (patch)
treeea34e42c1c32445ea210567a46526234fbb0767e /test/unit
parent3c04ea50ac60662e436ead8af09fd3a5559db199 (diff)
downloadfork-ledger-84b9ca73aac73b6c7938abea91f8f550a0fad101.tar.gz
fork-ledger-84b9ca73aac73b6c7938abea91f8f550a0fad101.tar.bz2
fork-ledger-84b9ca73aac73b6c7938abea91f8f550a0fad101.zip
add unit test printing for balance_t
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/t_balance.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index c4ec2f31..eac230be 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -522,4 +522,35 @@ BOOST_AUTO_TEST_CASE(testForZero)
BOOST_CHECK(b1.valid());
}
+BOOST_AUTO_TEST_CASE(testPrinting)
+{
+ amount_t a1("0.00");
+ amount_t a2("$ 123");
+ amount_t a3("EUR 456");
+
+ balance_t b0;
+ balance_t b1;
+
+ b1 += a1;
+ b1 += a2;
+ b1 += a3;
+
+ {
+ std::ostringstream bufstr;
+ b0.dump(bufstr);
+ BOOST_CHECK_EQUAL(std::string("BALANCE()"), bufstr.str());
+ }
+
+ {
+ std::ostringstream bufstr;
+ b1.dump(bufstr);
+
+ BOOST_CHECK_EQUAL(std::string("BALANCE(EUR 456, $ 123.00)"),
+ bufstr.str());
+ }
+
+ BOOST_CHECK(b0.valid());
+ BOOST_CHECK(b1.valid());
+}
+
BOOST_AUTO_TEST_SUITE_END()