diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2019-04-11 11:36:31 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-05-02 08:39:54 -0700 |
commit | 01fd6d52cefdb2baa7070b91ed483e9456141966 (patch) | |
tree | f43dae9b6291c28108b3896641374d643c7c8ca4 /host/tests | |
parent | d44277d7ac7acc621442fe7ef4555f568fbe88d0 (diff) | |
download | uhd-01fd6d52cefdb2baa7070b91ed483e9456141966.tar.gz uhd-01fd6d52cefdb2baa7070b91ed483e9456141966.tar.bz2 uhd-01fd6d52cefdb2baa7070b91ed483e9456141966.zip |
prop_tree: add pop() function
Adding pop function to property tree, which will remove and return a
property from the property tree. This also includes unit tests.
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/property_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/host/tests/property_test.cpp b/host/tests/property_test.cpp index f0e67e14c..907ca9f73 100644 --- a/host/tests/property_test.cpp +++ b/host/tests/property_test.cpp @@ -192,6 +192,7 @@ BOOST_AUTO_TEST_CASE(test_prop_tree) tree->create<int>("/test/prop0"); tree->create<int>("/test/prop1"); + tree->create<int>("/test/prop2"); BOOST_CHECK(tree->exists("/test")); BOOST_CHECK_THROW(tree->access<int>("/test"), std::exception); @@ -200,6 +201,7 @@ BOOST_AUTO_TEST_CASE(test_prop_tree) tree->access<int>("/test/prop0").set(42); tree->access<int>("/test/prop1").set(34); + tree->access<int>("/test/prop2").set(107); BOOST_CHECK_EQUAL(tree->access<int>("/test/prop0").get(), 42); BOOST_CHECK_EQUAL(tree->access<int>("/test/prop1").get(), 34); @@ -208,6 +210,12 @@ BOOST_AUTO_TEST_CASE(test_prop_tree) BOOST_CHECK(not tree->exists("/test/prop0")); BOOST_CHECK(tree->exists("/test/prop1")); + const uhd::fs_path prop_path = "/test/prop2"; + auto prop_sptr = tree->pop<int>(prop_path); + BOOST_CHECK(not tree->exists("/test/prop2")); + BOOST_CHECK(tree->exists("/test/prop1")); + BOOST_CHECK(prop_sptr->get() == 107); + tree->remove("/test"); BOOST_CHECK(not tree->exists("/test/prop0")); BOOST_CHECK(not tree->exists("/test/prop1")); |