summaryrefslogtreecommitdiff
path: root/test/unit/t_balance.cc
diff options
context:
space:
mode:
authortripun <tripun@gmail.com>2014-08-11 02:30:01 +0530
committertripun <tripun@gmail.com>2014-08-11 21:01:26 +0530
commit7e817d45d9c5a7cdee5d5df59e9794e8512a0d9a (patch)
tree0d2f2c9bc1b0815437bebe4d99434a1a78e01737 /test/unit/t_balance.cc
parentc5f41b85195cb3f671888289071d26531f198a80 (diff)
downloadfork-ledger-7e817d45d9c5a7cdee5d5df59e9794e8512a0d9a.tar.gz
fork-ledger-7e817d45d9c5a7cdee5d5df59e9794e8512a0d9a.tar.bz2
fork-ledger-7e817d45d9c5a7cdee5d5df59e9794e8512a0d9a.zip
add unit test Truth for balance_t
Diffstat (limited to 'test/unit/t_balance.cc')
-rw-r--r--test/unit/t_balance.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index 8f21e23f..468f03bb 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -476,4 +476,24 @@ BOOST_AUTO_TEST_CASE(testRound)
BOOST_CHECK(b4.valid());
}
+BOOST_AUTO_TEST_CASE(testTruth)
+{
+ 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;
+
+ BOOST_CHECK(!b0);
+ BOOST_CHECK(b1);
+
+ BOOST_CHECK(b0.valid());
+ BOOST_CHECK(b1.valid());
+}
+
BOOST_AUTO_TEST_SUITE_END()