summaryrefslogtreecommitdiff
path: root/test/unit/t_balance.cc
diff options
context:
space:
mode:
authortripun <tripun@gmail.com>2014-08-11 02:36:13 +0530
committertripun <tripun@gmail.com>2014-08-11 21:01:26 +0530
commit3c04ea50ac60662e436ead8af09fd3a5559db199 (patch)
tree1ff240bf03c692d6a06ad1c58a25e5352532800f /test/unit/t_balance.cc
parent7e817d45d9c5a7cdee5d5df59e9794e8512a0d9a (diff)
downloadfork-ledger-3c04ea50ac60662e436ead8af09fd3a5559db199.tar.gz
fork-ledger-3c04ea50ac60662e436ead8af09fd3a5559db199.tar.bz2
fork-ledger-3c04ea50ac60662e436ead8af09fd3a5559db199.zip
add unit test of Zero for balance_t
Diffstat (limited to 'test/unit/t_balance.cc')
-rw-r--r--test/unit/t_balance.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc
index 468f03bb..c4ec2f31 100644
--- a/test/unit/t_balance.cc
+++ b/test/unit/t_balance.cc
@@ -496,4 +496,30 @@ BOOST_AUTO_TEST_CASE(testTruth)
BOOST_CHECK(b1.valid());
}
+BOOST_AUTO_TEST_CASE(testForZero)
+{
+ 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.is_empty());
+ BOOST_CHECK(b0.is_zero());
+ BOOST_CHECK(b0.is_realzero());
+ BOOST_CHECK(!b0.is_nonzero());
+ BOOST_CHECK(!b1.is_empty());
+ BOOST_CHECK(!b1.is_zero());
+ BOOST_CHECK(!b1.is_realzero());
+ BOOST_CHECK(b1.is_nonzero());
+
+ BOOST_CHECK(b0.valid());
+ BOOST_CHECK(b1.valid());
+}
+
BOOST_AUTO_TEST_SUITE_END()