aboutsummaryrefslogtreecommitdiffstats
path: root/host/test
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-05-03 01:20:11 -0700
committerJosh Blum <josh@joshknows.com>2010-05-03 01:20:11 -0700
commit4d5df2376b204afb724684d0d864ce0d93fe83fb (patch)
treec0552615c8f51eb89c3214c8fed7105387264cae /host/test
parentfd0d9b7dcca13b4d8a4e1912682f58eb6b6ab634 (diff)
downloaduhd-4d5df2376b204afb724684d0d864ce0d93fe83fb.tar.gz
uhd-4d5df2376b204afb724684d0d864ce0d93fe83fb.tar.bz2
uhd-4d5df2376b204afb724684d0d864ce0d93fe83fb.zip
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.
Diffstat (limited to 'host/test')
-rw-r--r--host/test/addr_test.cpp17
1 files changed, 15 insertions, 2 deletions
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 <boost/test/unit_test.hpp>
#include <uhd/types/mac_addr.hpp>
#include <uhd/types/device_addr.hpp>
+#include <uhd/usrp/dboard_id.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
#include <algorithm>
@@ -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();
+}