diff options
Diffstat (limited to 'host/tests/error_test.cpp')
-rw-r--r-- | host/tests/error_test.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/host/tests/error_test.cpp b/host/tests/error_test.cpp index c76a15ab7..983f0150c 100644 --- a/host/tests/error_test.cpp +++ b/host/tests/error_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -16,19 +16,30 @@ // #include <boost/test/unit_test.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/exception.hpp> +#include <uhd/utils/assert_has.hpp> #include <vector> #include <iostream> +BOOST_AUTO_TEST_CASE(test_exception_methods){ + try{ + throw uhd::assertion_error("your assertion failed: 1 != 2"); + } + catch(const uhd::exception &e){ + std::cout << "what: " << e.what() << std::endl; + std::cout << "code: " << e.code() << std::endl; + } +} + BOOST_AUTO_TEST_CASE(test_assert_has){ std::vector<int> vec; vec.push_back(2); vec.push_back(3); vec.push_back(5); - //verify the std::has utility - BOOST_CHECK(std::has(vec, 2)); - BOOST_CHECK(not std::has(vec, 1)); + //verify the uhd::has utility + BOOST_CHECK(uhd::has(vec, 2)); + BOOST_CHECK(not uhd::has(vec, 1)); std::cout << "The output of the assert_has error:" << std::endl; try{ |