diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-25 16:39:32 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-25 20:22:23 -0700 |
commit | 81c15feaafca2b788b89e55669f1c3ad370a89d2 (patch) | |
tree | bddea1dab138bf5e8b3f690f0ef5cc6c032cb736 /host/tests | |
parent | a951db18fd0edfe19e9e75b91bb30dfa731dbd9c (diff) | |
download | uhd-81c15feaafca2b788b89e55669f1c3ad370a89d2.tar.gz uhd-81c15feaafca2b788b89e55669f1c3ad370a89d2.tar.bz2 uhd-81c15feaafca2b788b89e55669f1c3ad370a89d2.zip |
uhd: created a property tree to store properties
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/property_test.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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 <boost/test/unit_test.hpp> #include <uhd/property.hpp> +#include <uhd/property_tree.hpp> #include <boost/bind.hpp> +#include <iostream> 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<int>()); + tree->create("/test/prop1", uhd::property<int>()); + + BOOST_CHECK(tree->exists("/test")); + BOOST_CHECK(tree->exists("/test/prop0")); + BOOST_CHECK(tree->exists("/test/prop1")); + + tree->access<int>("/test/prop0").set(42); + tree->access<int>("/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")); + +} |