From 81c15feaafca2b788b89e55669f1c3ad370a89d2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 25 Jun 2011 16:39:32 -0700 Subject: uhd: created a property tree to store properties --- host/tests/property_test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'host/tests') diff --git a/host/tests/property_test.cpp b/host/tests/property_test.cpp index c5ef7f1c9..0cea20c8c 100644 --- a/host/tests/property_test.cpp +++ b/host/tests/property_test.cpp @@ -17,7 +17,9 @@ #include #include +#include #include +#include struct coercer_type{ int doit(int x){ @@ -73,3 +75,26 @@ BOOST_AUTO_TEST_CASE(test_prop_with_coercion){ BOOST_CHECK_EQUAL(prop.get(), 32); BOOST_CHECK_EQUAL(setter._x, 32); } + +BOOST_AUTO_TEST_CASE(test_prop_tree){ + uhd::property_tree::sptr tree = uhd::property_tree::make(); + + tree->create("/test/prop0", uhd::property()); + tree->create("/test/prop1", uhd::property()); + + BOOST_CHECK(tree->exists("/test")); + BOOST_CHECK(tree->exists("/test/prop0")); + BOOST_CHECK(tree->exists("/test/prop1")); + + tree->access("/test/prop0").set(42); + tree->access("/test/prop1").set(34); + + tree->remove("/test/prop0"); + BOOST_CHECK(not tree->exists("/test/prop0")); + BOOST_CHECK(tree->exists("/test/prop1")); + + tree->remove("/test"); + BOOST_CHECK(not tree->exists("/test/prop0")); + BOOST_CHECK(not tree->exists("/test/prop1")); + +} -- cgit v1.2.3