From 60933a242cce0b1ec45e9f948e3da9ab72b2fd90 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 8 Jul 2011 12:11:27 -0700 Subject: uhd: added unit test for properties subtree --- host/tests/property_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'host/tests') diff --git a/host/tests/property_test.cpp b/host/tests/property_test.cpp index 4c1aa046c..04d3a831c 100644 --- a/host/tests/property_test.cpp +++ b/host/tests/property_test.cpp @@ -157,3 +157,19 @@ BOOST_AUTO_TEST_CASE(test_prop_tree){ BOOST_CHECK(not tree->exists("/test/prop1")); } + +BOOST_AUTO_TEST_CASE(test_prop_subtree){ + uhd::property_tree::sptr tree = uhd::property_tree::make(); + tree->create("/subdir1/subdir2"); + + uhd::property_tree::sptr subtree1 = tree->subtree("/"); + const std::vector tree_dirs1 = tree->list("/"); + const std::vector subtree1_dirs = subtree1->list(""); + BOOST_CHECK_EQUAL_COLLECTIONS(tree_dirs1.begin(), tree_dirs1.end(), subtree1_dirs.begin(), subtree1_dirs.end()); + + uhd::property_tree::sptr subtree2 = subtree1->subtree("subdir1"); + const std::vector tree_dirs2 = tree->list("/subdir1"); + const std::vector subtree2_dirs = subtree2->list(""); + BOOST_CHECK_EQUAL_COLLECTIONS(tree_dirs2.begin(), tree_dirs2.end(), subtree2_dirs.begin(), subtree2_dirs.end()); + +} -- cgit v1.2.3