diff options
| -rw-r--r-- | libs/kstd/kstd/system_error.tests.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libs/kstd/kstd/system_error.tests.cpp b/libs/kstd/kstd/system_error.tests.cpp index 12f952b3..59e11926 100644 --- a/libs/kstd/kstd/system_error.tests.cpp +++ b/libs/kstd/kstd/system_error.tests.cpp @@ -1,6 +1,7 @@ #include <kstd/system_error.hpp> #include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> SCENARIO("Error condition initialization and construction", "[kstd][system_error]") { @@ -53,3 +54,47 @@ SCENARIO("Error code initialization and construction", "[kstd][system_error]") } } } + +SCENARIO("Error code messages", "[kstd][system_error]") +{ + GIVEN("An error code") + { + auto enumerator = GENERATE( + kstd::errc::address_family_not_supported, kstd::errc::address_in_use, kstd::errc::address_not_available, + kstd::errc::already_connected, kstd::errc::argument_list_too_long, kstd::errc::argument_out_of_domain, + kstd::errc::bad_address, kstd::errc::bad_file_descriptor, kstd::errc::bad_message, kstd::errc::broken_pipe, + kstd::errc::connection_aborted, kstd::errc::connection_already_in_progress, kstd::errc::connection_refused, + kstd::errc::connection_reset, kstd::errc::cross_device_link, kstd::errc::destination_address_required, + kstd::errc::device_or_resource_busy, kstd::errc::directory_not_empty, kstd::errc::executable_format_error, + kstd::errc::file_exists, kstd::errc::file_too_large, kstd::errc::filename_too_long, + kstd::errc::function_not_supported, kstd::errc::host_unreachable, kstd::errc::identifier_removed, + kstd::errc::illegal_byte_sequence, kstd::errc::inappropriate_io_control_operation, kstd::errc::interrupted, + kstd::errc::invalid_argument, kstd::errc::invalid_seek, kstd::errc::io_error, kstd::errc::is_a_directory, + kstd::errc::message_size, kstd::errc::network_down, kstd::errc::network_reset, kstd::errc::network_unreachable, + kstd::errc::no_buffer_space, kstd::errc::no_child_process, kstd::errc::no_link, kstd::errc::no_lock_available, + kstd::errc::no_message, kstd::errc::no_protocol_option, kstd::errc::no_space_on_device, + kstd::errc::no_such_device_or_address, kstd::errc::no_such_device, kstd::errc::no_such_file_or_directory, + kstd::errc::no_such_process, kstd::errc::not_a_directory, kstd::errc::not_a_socket, kstd::errc::not_connected, + kstd::errc::not_enough_memory, kstd::errc::not_supported, kstd::errc::operation_canceled, + kstd::errc::operation_in_progress, kstd::errc::operation_not_permitted, kstd::errc::operation_not_supported, + kstd::errc::operation_would_block, kstd::errc::owner_dead, kstd::errc::permission_denied, + kstd::errc::protocol_error, kstd::errc::protocol_not_supported, kstd::errc::read_only_file_system, + kstd::errc::resource_deadlock_would_occur, kstd::errc::resource_unavailable_try_again, + kstd::errc::result_out_of_range, kstd::errc::state_not_recoverable, kstd::errc::text_file_busy, + kstd::errc::timed_out, kstd::errc::too_many_files_open_in_system, kstd::errc::too_many_files_open, + kstd::errc::too_many_links, kstd::errc::too_many_symbolic_link_levels, kstd::errc::value_too_large, + kstd::errc::wrong_protocol_type); + + auto error = kstd::make_error_code(enumerator); + + WHEN("getting the message") + { + auto message = error.message(); + + THEN("the message is not 'unknown error'") + { + REQUIRE(message != "unknown error"); + } + } + } +} |
