diff options
-rw-r--r-- | test/unit/t_balance.cc | 26 |
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() |