summaryrefslogtreecommitdiff
path: root/test/unit/t_value.cc
diff options
context:
space:
mode:
authortripun <tripun@gmail.com>2014-08-18 01:24:52 +0530
committertripun <tripun@gmail.com>2014-08-18 01:27:04 +0530
commite0f2e0ad29204632ffd3be8575173184314932f3 (patch)
tree7172ac44b91b8b70ac42ae79e66f38401b3f0281 /test/unit/t_value.cc
parent66d89d92f20740d008338bade3dc4b195cbf3692 (diff)
downloadfork-ledger-e0f2e0ad29204632ffd3be8575173184314932f3.tar.gz
fork-ledger-e0f2e0ad29204632ffd3be8575173184314932f3.tar.bz2
fork-ledger-e0f2e0ad29204632ffd3be8575173184314932f3.zip
check Type unit test for value
Diffstat (limited to 'test/unit/t_value.cc')
-rw-r--r--test/unit/t_value.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/unit/t_value.cc b/test/unit/t_value.cc
index dfbd94d1..a14ac167 100644
--- a/test/unit/t_value.cc
+++ b/test/unit/t_value.cc
@@ -493,5 +493,55 @@ BOOST_AUTO_TEST_CASE(testDivision)
BOOST_CHECK(v17.valid());
}
+BOOST_AUTO_TEST_CASE(testType)
+{
+ value_t v1;
+ value_t v2(true);
+ value_t v3(boost::posix_time::from_time_t(time_t(NULL)));
+ value_t v4(date_t(parse_date("2014/08/14")));
+ value_t v5(2L);
+ value_t v6(4UL);
+ value_t v7(1.00);
+ value_t v8(amount_t("4 GBP"));
+ value_t v9(balance_t("3 EUR"));
+ value_t v10(mask_t("regex"));
+ value_t v11(new value_t::sequence_t());
+ value_t v12(string("$1"));
+ value_t v13("2 CAD");
+ value_t v14("comment", true);
+ value_t v15(string("tag"), true);
+
+ BOOST_CHECK(v2.is_boolean());
+ BOOST_CHECK(v3.is_datetime());
+ BOOST_CHECK(v4.is_date());
+ BOOST_CHECK(v5.is_long());
+ BOOST_CHECK(v6.is_amount());
+ BOOST_CHECK(v7.is_amount());
+ BOOST_CHECK(v8.is_amount());
+ BOOST_CHECK(v9.is_balance());
+ BOOST_CHECK(v10.is_mask());
+ BOOST_CHECK(v11.is_boolean());
+ BOOST_CHECK(v12.is_amount());
+ BOOST_CHECK(v13.is_amount());
+ BOOST_CHECK(v14.is_string());
+ BOOST_CHECK(v15.is_string());
+
+ BOOST_CHECK(v1.valid());
+ BOOST_CHECK(v2.valid());
+ BOOST_CHECK(v3.valid());
+ BOOST_CHECK(v4.valid());
+ BOOST_CHECK(v5.valid());
+ BOOST_CHECK(v6.valid());
+ BOOST_CHECK(v7.valid());
+ BOOST_CHECK(v8.valid());
+ BOOST_CHECK(v9.valid());
+ BOOST_CHECK(v10.valid());
+ BOOST_CHECK(v11.valid());
+ BOOST_CHECK(v12.valid());
+ BOOST_CHECK(v13.valid());
+ BOOST_CHECK(v14.valid());
+ BOOST_CHECK(v15.valid());
+}
+
BOOST_AUTO_TEST_SUITE_END()