3#include "../../catch2/catch.hpp"
5#include "../../../include/error/error.hpp"
17TEST_CASE(
"Test error_t boolean operators and functions",
"[error::error]" )
19 #if MXLIBTEST_DOXYGEN_REF
25 SECTION(
"operator!" )
29 REQUIRE(!errc ==
true);
30 REQUIRE(!!errc ==
false);
33 REQUIRE(!errc ==
false);
34 REQUIRE(!!errc ==
true);
37 SECTION(
"operator==" )
41 REQUIRE((errc ==
false));
42 REQUIRE(!(errc ==
true));
45 REQUIRE((errc ==
true));
46 REQUIRE(!(errc ==
false));
49 SECTION(
"operator!=" )
53 REQUIRE(!(errc !=
false));
54 REQUIRE((errc !=
true));
57 REQUIRE(!(errc !=
true));
58 REQUIRE((errc !=
false));
76TEST_CASE(
"Internal error messages",
"[error::error]" )
78 #ifdef MXLIBTEST_DOXYGEN_REF
112 SECTION(
"verbose::vv")
127 SECTION(
"verbose::vvv")
149 #ifdef MXLIBTEST_DOXYGEN_REF
153 SECTION(
"verbose::o")
168 SECTION(
"verbose::v")
183 SECTION(
"verbose::vv")
198 SECTION(
"verbose::vvv")
203 errc = mx::internal::mxlib_error_report<mx::verbose::vvv>(
mx::error_t::error,
"test");
220 #ifdef MXLIBTEST_DOXYGEN_REF
224 SECTION(
"verbose::o")
239 SECTION(
"verbose::v")
254 SECTION(
"verbose::vv")
269 SECTION(
"verbose::vvv")
291 #ifdef MXLIBTEST_DOXYGEN_REF
295 SECTION(
"verbose::o")
310 SECTION(
"verbose::v")
325 SECTION(
"verbose::vv")
340 SECTION(
"verbose::vvv")
422 #if MXLIBTEST_DOXYGEN_REF
431 SECTION(
"mx_error_check")
439 SECTION(
"mx_error_check_code")
447 SECTION(
"mx_error_check_rv")
454 SECTION(
"mx_error_check_code_rv")
461 SECTION(
"mx_error_return")
468 SECTION(
"mx_error_return_code")
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.