44 #include <type_traits>
52 void does_not_throw () {
55 void throws_runtime_error () {
56 throw std::runtime_error (
"Not a LinearSolverSetupFailure");
60 out <<
"Test that LinearSolverSetupFailure has a what() method that "
61 "returns something convertible to std::string, and test that the "
62 "resulting message is as expected" << std::endl;
70 const std::string msg (e.what ());
77 out <<
"Test that LinearSolverSetupFailure is a subclass of "
78 "std::runtime_error" << std::endl;
81 bool first_threw =
false;
85 catch (std::runtime_error& e) {
87 const std::string msg (e.what ());
91 static_assert (std::has_virtual_destructor<Trilinos::LinearSolverSetupFailure>::value,
92 "LinearSolverSetupFailure does not have a virtual destructor. "
93 "This is bad for memory safety, because LinearSolverSetupFailure "
94 "inherits from a class with virtual methods.");
96 bool second_threw =
false;
98 throws_runtime_error ();
100 catch (std::runtime_error& e) {
102 const std::string msg (e.what ());
103 TEST_ASSERT(msg ==
"Not a LinearSolverSetupFailure");
112 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.