33#include < cstdint>
44#include < exception>
55#include < iostream>
6- #include < string_view>
6+ #include < string>
7+ #include < system_error>
78
89#include < ystdlib/containers/Array.hpp>
910#include < ystdlib/error_handling/ErrorCode.hpp>
@@ -17,18 +18,28 @@ enum class BinaryErrorCodeEnum : uint8_t {
1718};
1819
1920using BinaryErrorCode = ystdlib::error_handling::ErrorCode<BinaryErrorCodeEnum>;
20-
2121using BinaryErrorCategory = ystdlib::error_handling::ErrorCategory<BinaryErrorCodeEnum>;
2222
23- constexpr std::string_view cBinaryTestErrorCategoryName{" Binary Error Code" };
24-
2523template <>
2624auto BinaryErrorCategory::name () const noexcept -> char const * {
27- return cBinaryTestErrorCategoryName.data ();
25+ return " Binary Error Code" ;
26+ }
27+
28+ template <>
29+ auto BinaryErrorCategory::message (BinaryErrorCodeEnum error_enum) const -> std::string {
30+ switch (error_enum) {
31+ case BinaryErrorCodeEnum::Success:
32+ return std::string{" Success" };
33+ case BinaryErrorCodeEnum::Failure:
34+ return std::string{" Failure" };
35+ default :
36+ return std::string{" Unrecognized Error Code" };
37+ }
2838}
2939
3040YSTDLIB_ERROR_HANDLING_MARK_AS_ERROR_CODE_ENUM (BinaryErrorCodeEnum);
3141
42+ namespace {
3243using ystdlib::io_interface::ErrorCode;
3344
3445class FailureReader : ystdlib::io_interface::ReaderInterface {
@@ -51,16 +62,15 @@ class FailureReader : ystdlib::io_interface::ReaderInterface {
5162 }
5263};
5364
54- namespace {
5565auto test_containers () -> bool {
5666 try {
5767 constexpr size_t cBufferSize{1024 };
5868 ystdlib::containers::Array<size_t > arr (cBufferSize);
59- for (size_t idx{0 }; idx < cBufferSize; ++idx) {
60- arr.at (idx) = idx;
61- }
62- auto const & arr_const_ref = arr;
63- return std::ranges::equal (arr, arr_const_ref);
69+ for (size_t idx{0 }; idx < cBufferSize; ++idx) {
70+ arr.at (idx) = idx;
71+ }
72+ auto const & arr_const_ref = arr;
73+ return std::ranges::equal (arr, arr_const_ref);
6474 } catch (std::exception const &) {
6575 return false ;
6676 }
@@ -83,7 +93,7 @@ auto test_wrapped_facade_headers() -> bool {
8393 quad_t const quadt{3 };
8494 return 1 == uint && 2 == ulong && 3 == quadt;
8595}
86- }
96+ } // namespace
8797
8898auto main () -> int {
8999 if (false == test_containers ()) {
0 commit comments