Go to the documentation of this file.
48 std::cout <<
"\nTesting test_CEException:\n";
68 std::string msg =
"Testing throwing 'CEException::invalid_value'";
75 log_failure(
"CEException::invalid_value failed to throw", __func__, __LINE__);
79 log_success(
"CEException::invalid_value thrown successfully", __func__, __LINE__);
83 std::string test_msg(e.
message());
84 test_string(test_msg, msg, __func__, __LINE__);
87 std::string test_trace(e.
trace());
88 test_greaterthan(test_trace.size(), 1, __func__, __LINE__);
91 std::string test_what(e.
what());
92 test_greaterthan(test_what.size(), test_msg.size()+test_trace.size(), __func__, __LINE__);
95 std::string msg2(
" ... now with more text!");
97 test_msg = std::string(e.
message());
98 test_string(test_msg, msg+msg2, __func__, __LINE__);
114 "Testing throwing 'CEException::invalid_value'");
116 log_failure(
"CEException::invalid_value failed to throw", __func__, __LINE__);
120 log_success(
"CEException::invalid_value thrown successfully", __func__, __LINE__);
138 "No method currently checked",
139 1,
"Testing throwing 'CEException::sofa_error");
141 log_failure(
"CEException::sofa_error failed to throw", __func__, __LINE__);
145 log_success(
"CEException::sofa_error thrown successfully", __func__, __LINE__);
163 "No method currently checked",
164 "Testing throwing 'CEException::sofa_exception'");
166 log_failure(
"CEException::sofa_exception failed to throw", __func__, __LINE__);
170 log_success(
"CEException::sofa_exception thrown successfully", __func__, __LINE__);
188 "Testing throwing 'CEException::corr_file_load_error'");
190 log_failure(
"CEException::corr_file_load_error failed to throw", __func__, __LINE__);
194 log_success(
"CEException::corr_file_load_error thrown and caught successfully", __func__, __LINE__);
205 int main(
int argc,
char** argv)
test_CEException()
Default constructor.
int main(int argc, char **argv)
Main method that actually runs the tests.
virtual void message(const std::string &msg)
Overwrite the error message.
virtual bool test_sofa_exception(void)
Try throwing 'CEException::sofa_exception'.
virtual const char * trace(void) const noexcept
Return the backtrace string.
virtual void message_append(const std::string &msg)
Append a string to the end of the message.
virtual ~test_CEException()
Destructor.
virtual bool test_construct(void)
Try constructing and accesing information about a CEException.
virtual bool test_invalid_value(void)
Try throwing 'CEException::invalid_value'.
virtual bool runtests()
Run tests.
virtual bool test_sofa_error(void)
Try throwing 'CEException::sofa_errcode'.
virtual const char * what() const noexcept
Generates and returns the error message.
virtual bool test_corr_file_except(void)
Try throwing 'CEException::sofa_exception'.