12 #include <type_traits>
20 void does_not_throw () {
23 void throws_runtime_error () {
24 throw std::runtime_error (
"Not a LinearSolverSetupFailure");
28 out <<
"Test that LinearSolverSetupFailure has a what() method that "
29 "returns something convertible to std::string, and test that the "
30 "resulting message is as expected" << std::endl;
38 const std::string msg (e.what ());
45 out <<
"Test that LinearSolverSetupFailure is a subclass of "
46 "std::runtime_error" << std::endl;
49 bool first_threw =
false;
53 catch (std::runtime_error& e) {
55 const std::string msg (e.what ());
59 static_assert (std::has_virtual_destructor<Trilinos::LinearSolverSetupFailure>::value,
60 "LinearSolverSetupFailure does not have a virtual destructor. "
61 "This is bad for memory safety, because LinearSolverSetupFailure "
62 "inherits from a class with virtual methods.");
64 bool second_threw =
false;
66 throws_runtime_error ();
68 catch (std::runtime_error& e) {
70 const std::string msg (e.what ());
71 TEST_ASSERT(msg ==
"Not a LinearSolverSetupFailure");
80 out <<
"LinearSolverSetupFailure Test0" << endl;
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
Declaration and definition of Trilinos::LinearSolverSetupFailure exception class. ...
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Tabbing class for helping to create formated, indented output for a basic_FancyOStream object...
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among ...
Exception reporting failure in setting up a linear solver.