#define CODE_ERROR_LOCATIONS #include #include "Errors.hpp" #include #include #include "TypeTraits.hpp" using namespace nb; class TestError : public Error { using Base = Error; public: using Base::Base; using Base::what; using Base::code; using Base::msg; using Base::trace; enum Codes : unsigned int { A, B, C, D }; static const std::string type; static const nb::ErrorCodeMap ErrorMessages; }; const std::string TestError::type="TestError"; const ErrorCodeMap TestError::ErrorMessages{ {TestError::Codes::A, "Hey!"}, {TestError::Codes::B, "How"}, {TestError::Codes::C, "You"}, {TestError::Codes::D, "Doin"} }; TEST(ErrorTest, Test) { auto err = TestError(0, TestError(1)); nb::stream(std::cout, "len string: ", err.what_str().length(), "\n", "len wstring: ", err.what_str().length(), "\n" ); nb::stream(std::wcout, err.what_str(), L"\n" ); }