From 4d5df2376b204afb724684d0d864ce0d93fe83fb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 3 May 2010 01:20:11 -0700 Subject: Expanded the dboard id API to create dboard id types from strings and ints. And created utility functions to go between representations. Created to_pp_string for pretty print strings for dboard ids and device addrs. Minor changes to the various classes that call these utilities. --- host/test/addr_test.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'host/test/addr_test.cpp') diff --git a/host/test/addr_test.cpp b/host/test/addr_test.cpp index 93b7cc0df..0c50200d6 100644 --- a/host/test/addr_test.cpp +++ b/host/test/addr_test.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -41,8 +42,8 @@ BOOST_AUTO_TEST_CASE(test_device_addr){ dev_addr["key2"] = "val2"; //convert to and from args string - std::cout << "Pretty Print: " << std::endl << dev_addr.to_string(); - std::string args_str = dev_addr.to_args_str(); + std::cout << "Pretty Print: " << std::endl << dev_addr.to_pp_string(); + std::string args_str = dev_addr.to_string(); std::cout << "Args String: " << args_str << std::endl; uhd::device_addr_t new_dev_addr(args_str); @@ -65,3 +66,15 @@ BOOST_AUTO_TEST_CASE(test_device_addr){ new_dev_addr_vals.begin(), new_dev_addr_vals.end() ); } + +BOOST_AUTO_TEST_CASE(test_dboard_id){ + std::cout << "Testing dboard id..." << std::endl; + + using namespace uhd::usrp; + + BOOST_CHECK(dboard_id_t() == dboard_id_t::none()); + BOOST_CHECK_EQUAL(dboard_id_t().to_uint16(), dboard_id_t::none().to_uint16()); + BOOST_CHECK_EQUAL(dboard_id_t::from_string("0x1234").to_uint16(), 0x1234); + BOOST_CHECK_EQUAL(dboard_id_t::from_string("1234").to_uint16(), 1234); + std::cout << "Pretty Print: " << std::endl << dboard_id_t::none().to_pp_string(); +} -- cgit v1.2.3