diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_find.cpp | 2 | ||||
-rw-r--r-- | host/lib/utils/serial_number.cpp | 5 | ||||
-rw-r--r-- | host/tests/serial_number_test.cpp | 16 |
3 files changed, 11 insertions, 12 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp index 9c7ea8958..e436c3998 100644 --- a/host/lib/usrp/mpmd/mpmd_find.cpp +++ b/host/lib/usrp/mpmd/mpmd_find.cpp @@ -112,7 +112,7 @@ device_addrs_t mpmd_find_with_addr( } // filter the discovered device below by matching optional keys if ((not hint_.has_key("name") or hint_["name"] == new_addr["name"]) - and (not hint_.has_key("serial") or uhd::serial_numbers_match(hint_["serial"], new_addr["serial"])) + and (not hint_.has_key("serial") or utils::serial_numbers_match(hint_["serial"], new_addr["serial"])) and (not hint_.has_key("type") or hint_["type"] == new_addr["type"] or hint_["type"] == MPM_CATCHALL_DEVICE_TYPE) and (not hint_.has_key("product") diff --git a/host/lib/utils/serial_number.cpp b/host/lib/utils/serial_number.cpp index 7fd0863d6..af66197fd 100644 --- a/host/lib/utils/serial_number.cpp +++ b/host/lib/utils/serial_number.cpp @@ -8,8 +8,7 @@ #include <stdexcept> #include <string> -namespace uhd -{ +namespace uhd { namespace utils { bool serial_numbers_match(const std::string& serial_a, const std::string& serial_b) { try { @@ -20,4 +19,4 @@ namespace uhd return false; } } -} +}} diff --git a/host/tests/serial_number_test.cpp b/host/tests/serial_number_test.cpp index 11c7f5372..f2dc4bb42 100644 --- a/host/tests/serial_number_test.cpp +++ b/host/tests/serial_number_test.cpp @@ -9,14 +9,14 @@ BOOST_AUTO_TEST_CASE(test_serial_numbers_match) { - BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("abcd123", "abcd123")); - BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("0abcd123", "0abcd123")); - BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("0abcd123", "abcd1230")); - BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("abcd123", "abcd124")); - BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("abcd123", "321dcba")); - BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("abcd123", "0abcd123")); - BOOST_CHECK_EQUAL(true, uhd::serial_numbers_match("0abcd123", "abcd123")); + BOOST_CHECK_EQUAL(true, uhd::utils::serial_numbers_match("abcd123", "abcd123")); + BOOST_CHECK_EQUAL(true, uhd::utils::serial_numbers_match("0abcd123", "0abcd123")); + BOOST_CHECK_EQUAL(false, uhd::utils::serial_numbers_match("0abcd123", "abcd1230")); + BOOST_CHECK_EQUAL(false, uhd::utils::serial_numbers_match("abcd123", "abcd124")); + BOOST_CHECK_EQUAL(false, uhd::utils::serial_numbers_match("abcd123", "321dcba")); + BOOST_CHECK_EQUAL(true, uhd::utils::serial_numbers_match("abcd123", "0abcd123")); + BOOST_CHECK_EQUAL(true, uhd::utils::serial_numbers_match("0abcd123", "abcd123")); // Out of range - BOOST_CHECK_EQUAL(false, uhd::serial_numbers_match("aaaaaaaaaaaaaa", "abcd123")); + BOOST_CHECK_EQUAL(false, uhd::utils::serial_numbers_match("aaaaaaaaaaaaaa", "abcd123")); } |