4#include "../../catch2/catch.hpp"
18TEST_CASE(
"Test error_t boolean operators and functions",
"[error::error]" )
20 #if MXLIBTEST_DOXYGEN_REF
26 SECTION(
"operator!" )
30 REQUIRE(!errc ==
true);
31 REQUIRE(!!errc ==
false);
34 REQUIRE(!errc ==
false);
35 REQUIRE(!!errc ==
true);
38 SECTION(
"operator==" )
42 REQUIRE((errc ==
false));
43 REQUIRE(!(errc ==
true));
46 REQUIRE((errc ==
true));
47 REQUIRE(!(errc ==
false));
50 SECTION(
"operator!=" )
54 REQUIRE(!(errc !=
false));
55 REQUIRE((errc !=
true));
58 REQUIRE(!(errc !=
true));
59 REQUIRE((errc !=
false));
77TEST_CASE(
"Internal error messages",
"[error::error]" )
79 #ifdef MXLIBTEST_DOXYGEN_REF
113 SECTION(
"verbose::vv")
128 SECTION(
"verbose::vvv")
150 #ifdef MXLIBTEST_DOXYGEN_REF
154 SECTION(
"verbose::o")
169 SECTION(
"verbose::v")
184 SECTION(
"verbose::vv")
199 SECTION(
"verbose::vvv")
221 #ifdef MXLIBTEST_DOXYGEN_REF
225 SECTION(
"verbose::o")
240 SECTION(
"verbose::v")
255 SECTION(
"verbose::vv")
270 SECTION(
"verbose::vvv")
292 #ifdef MXLIBTEST_DOXYGEN_REF
296 SECTION(
"verbose::o")
311 SECTION(
"verbose::v")
326 SECTION(
"verbose::vv")
341 SECTION(
"verbose::vvv")
383 typedef mx::verbose::vv verboseT;
392 typedef mx::verbose::vv verboseT;
401 typedef mx::verbose::vv verboseT;
409 typedef mx::verbose::vv verboseT;
423 #if MXLIBTEST_DOXYGEN_REF
432 SECTION(
"mx_error_check")
440 SECTION(
"mx_error_check_code")
448 SECTION(
"mx_error_check_rv")
455 SECTION(
"mx_error_check_code_rv")
462 SECTION(
"mx_error_return")
469 SECTION(
"mx_error_return_code")
The mxlib error reporting system.
TEST_CASE("Test error_t boolean operators and functions", "[error::error]")
Test error_t boolean operators and functions.
error_t
The mxlib error codes.
@ noerror
No error has occurred.
@ exception
An exception was thrown.
@ eacces
Permission denied (EACCES).
@ error
A general error has occurred.
#define mx_error_return_code(errc)
Perform an error check on an error_t code and return the result.
bool operator!(const error_t &errc)
Check if an error_t code is an error.
std::string error_message< mx::verbose::vvv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::vvv.
bool operator==(const error_t &errc, bool tf)
Check if an error_t code is an error.
std::string error_message< mx::verbose::v >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::v.
#define mx_error_check_code_rv(errc, rv)
Perform an error check on an error_t code.
std::string error_message< mx::verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::o.
#define mx_error_check(fxn)
Perform an error check on the output of a function.
error_t error_report(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Print a report to stderr given an mxlib error_t code and explanation and return the code.
error_t error_report< mx::verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_report for verbose::o.
std::string error_message(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Format a report given an mxlib error_t code and explanation.
bool isError(const error_t &errc)
Check if an error_t code is an error.
#define mx_error_check_code(errc)
Perform an error check on an error_t code.
bool operator!=(const error_t &errc, bool tf)
Check if an error_t code is not an error.
#define mx_error_check_rv(fxn, rv)
Perform an error check on the output of a function.
#define mx_error_return(fxn)
Perform an error check on a function and return the result.
std::string error_message< mx::verbose::vv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::vv.
error_t mxlib_error_report(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Print a report to stderr given an mxlib error_t code and explanation and return the code.
error_t mxlib_error_report< mx::verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_report for verbose::o.
std::string mxlib_error_message< mx::verbose::vv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::vv.
std::string mxlib_error_message< mx::verbose::v >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::v.
std::string mxlib_error_message< mx::verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::o.
std::string mxlib_error_message< mx::verbose::vvv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::vvv.
std::string mxlib_error_message(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Format a report given an mxlib error_t code and explanation.
Verbosity level 2. Additional information is provided, including source file and line.