1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include "aocommon/throwruntimeerror.h"
#include <boost/test/unit_test.hpp>
#include <string>
BOOST_AUTO_TEST_SUITE(throw_runtime_error)
BOOST_AUTO_TEST_CASE(throw_runtime_error) {
BOOST_CHECK_EXCEPTION(
aocommon::ThrowRuntimeError(), std::runtime_error,
[](const std::runtime_error& e) { return e.what() == std::string(); });
BOOST_CHECK_EXCEPTION(
aocommon::ThrowRuntimeError('a', "bc", std::string("def"), 123),
std::runtime_error, [](const std::runtime_error& e) {
return e.what() == std::string("abcdef123");
});
}
BOOST_AUTO_TEST_SUITE_END()
|