4#include "../../catch2/catch.hpp"
8#define MXLIBTEST_ERROR_T_TESTS
22TEST_CASE(
"Test error_t code names",
"[error::error_t]" )
24 std::vector<mx::error_t> errcs;
25 mx::error_t_vector( errcs );
27 REQUIRE(errcs.size() > 0);
30 for(
auto & errc : errcs)
33 if(name ==
"" || name ==
"unknown error_t (bug)")
41 int nv =
static_cast<int>(*std::max_element(errcs.begin(), errcs.end()));
43 REQUIRE(nv != std::numeric_limits<int>::max());
54TEST_CASE(
"Test error_t messages",
"[error::error_t]" )
56 std::vector<mx::error_t> errcs;
57 mx::error_t_vector( errcs );
59 REQUIRE(errcs.size() > 0);
62 for(
auto & errc : errcs)
65 if(msg ==
"" || msg ==
"unknown error_t (bug)")
73 int nv =
static_cast<int>(*std::max_element(errcs.begin(), errcs.end()));
75 REQUIRE(nv != std::numeric_limits<int>::max());
84TEST_CASE(
"Test errno conversions",
"[error::error_t]" )
86 std::vector<int> errnos;
87 mx::errno_vector( errnos );
89 REQUIRE(errnos.size() > 0);
92 for(
auto & en : errnos)
103 int nv = *std::max_element(errnos.begin(), errnos.end());
105 REQUIRE(nv != std::numeric_limits<int>::max());
114TEST_CASE(
"Test FITS error conversions",
"[error::error_t]" )
116 std::vector<int> fitserrs;
117 mx::fitserr_vector( fitserrs );
119 REQUIRE(fitserrs.size() > 0);
122 for(
auto & fe : fitserrs)
133 int nv = *std::max_element(fitserrs.begin(), fitserrs.end());
135 REQUIRE(nv != std::numeric_limits<int>::max());
The mxlib error reporting system.
The mxlib error_t type and utilities.
TEST_CASE("Test error_t code names", "[error::error_t]")
Test error_t code names.
error_t
The mxlib error codes.
static constexpr const char * errorName(const error_t &errc)
Convert a error_t code to its name.
static constexpr error_t errno2error_t(const int &err)
Convert an errno code to error_t.
static constexpr const char * errorMessage(const error_t &errc)
Get the descriptive message for a error_t code.
@ error
A general error has occurred.
static constexpr error_t fits_status2error_t(const int &err)
Convert a FITS status code to error_t.