diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2015-08-12 12:19:20 -0700 |
---|---|---|
committer | Nicholas Corgan <nick.corgan@ettus.com> | 2015-08-12 12:19:20 -0700 |
commit | bc9dd05988454428de1b6efd235d980b8eaa9afe (patch) | |
tree | f61a72cfb1cfa81305e75e11a1646a12ed4b63cf /host/tests/error_c_test.cpp | |
parent | 95108f6f6ed6bf44fe38fc9e686fc9c5ae9c0e65 (diff) | |
download | uhd-bc9dd05988454428de1b6efd235d980b8eaa9afe.tar.gz uhd-bc9dd05988454428de1b6efd235d980b8eaa9afe.tar.bz2 uhd-bc9dd05988454428de1b6efd235d980b8eaa9afe.zip |
C API cleanup, feature additions
* Cleaned up usage of handles vs. handle pointers
* Store global string for last error thrown
* Removed uhd::device_addr_t handle, added std::vector<std::string> handle
Diffstat (limited to 'host/tests/error_c_test.cpp')
-rw-r--r-- | host/tests/error_c_test.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/host/tests/error_c_test.cpp b/host/tests/error_c_test.cpp index bb9454678..8eb90f3d4 100644 --- a/host/tests/error_c_test.cpp +++ b/host/tests/error_c_test.cpp @@ -82,10 +82,11 @@ static const uhd::dict<std::string, std::string> pretty_exception_names = uhd::cpp_exception_type cpp_exception_type ## _foo(expected_msg); \ error_code = throw_uhd_exception<uhd::cpp_exception_type>(&handle, &cpp_exception_type ## _foo); \ BOOST_CHECK_EQUAL(error_code, c_error_code); \ - BOOST_CHECK_EQUAL(handle.last_error, \ - str(boost::format("%s: %s") \ - % pretty_exception_names.get(BOOST_STRINGIZE(cpp_exception_type)) \ - % expected_msg)); + expected_msg = str(boost::format("%s: %s") \ + % pretty_exception_names.get(BOOST_STRINGIZE(cpp_exception_type)) \ + % expected_msg); \ + BOOST_CHECK_EQUAL(handle.last_error, expected_msg); \ + BOOST_CHECK_EQUAL(get_c_global_error_string(), expected_msg); // uhd::usb_error has a different constructor #define UHD_TEST_CHECK_USB_ERROR_CODE() \ @@ -93,10 +94,11 @@ static const uhd::dict<std::string, std::string> pretty_exception_names = uhd::usb_error usb_error_foo(1, expected_msg); \ error_code = throw_uhd_exception<uhd::usb_error>(&handle, &usb_error_foo); \ BOOST_CHECK_EQUAL(error_code, UHD_ERROR_USB); \ - BOOST_CHECK_EQUAL(handle.last_error, \ - str(boost::format("%s: %s") \ - % pretty_exception_names.get("usb_error") \ - % expected_msg)); + expected_msg = str(boost::format("%s: %s") \ + % pretty_exception_names.get("usb_error") \ + % expected_msg); \ + BOOST_CHECK_EQUAL(handle.last_error, expected_msg); \ + BOOST_CHECK_EQUAL(get_c_global_error_string(), expected_msg); BOOST_AUTO_TEST_CASE(test_uhd_exception){ dummy_handle_t handle; |