3#include "../../catch2/catch.hpp"
5#include "../../../include/error/error.hpp"
7#define MXLIBTEST_ERROR_T_TESTS
8#include "../../../include/error/error_t.hpp"
21TEST_CASE(
"Test error_t code names",
"[error::error_t]" )
23 std::vector<mx::error_t> errcs;
24 mx::error_t_vector( errcs );
26 REQUIRE(errcs.size() > 0);
29 for(
auto & errc : errcs)
32 if(name ==
"" || name ==
"unknown error_t (bug)")
40 int nv =
static_cast<int>(*std::max_element(errcs.begin(), errcs.end()));
42 REQUIRE(nv != std::numeric_limits<int>::max());
53TEST_CASE(
"Test error_t messages",
"[error::error_t]" )
55 std::vector<mx::error_t> errcs;
56 mx::error_t_vector( errcs );
58 REQUIRE(errcs.size() > 0);
61 for(
auto & errc : errcs)
64 if(msg ==
"" || msg ==
"unknown error_t (bug)")
72 int nv =
static_cast<int>(*std::max_element(errcs.begin(), errcs.end()));
74 REQUIRE(nv != std::numeric_limits<int>::max());
83TEST_CASE(
"Test errno conversions",
"[error::error_t]" )
85 std::vector<int> errnos;
86 mx::errno_vector( errnos );
88 REQUIRE(errnos.size() > 0);
91 for(
auto & en : errnos)
102 int nv = *std::max_element(errnos.begin(), errnos.end());
104 REQUIRE(nv != std::numeric_limits<int>::max());
113TEST_CASE(
"Test FITS error conversions",
"[error::error_t]" )
115 std::vector<int> fitserrs;
116 mx::fitserr_vector( fitserrs );
118 REQUIRE(fitserrs.size() > 0);
121 for(
auto & fe : fitserrs)
132 int nv = *std::max_element(fitserrs.begin(), fitserrs.end());
134 REQUIRE(nv != std::numeric_limits<int>::max());
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.