diff --git a/iceoryx2-ffi/cxx/CMakeLists.txt b/iceoryx2-ffi/cxx/CMakeLists.txt index 386a7b830..20d2b114c 100644 --- a/iceoryx2-ffi/cxx/CMakeLists.txt +++ b/iceoryx2-ffi/cxx/CMakeLists.txt @@ -37,7 +37,6 @@ target_include_directories(includes-only-cxx add_library(iceoryx2-cxx-object-lib OBJECT src/config.cpp - src/error_string.cpp src/event_id.cpp src/file_descriptor.cpp src/header_publish_subscribe.cpp diff --git a/iceoryx2-ffi/cxx/include/iox2/config_creation_error.hpp b/iceoryx2-ffi/cxx/include/iox2/config_creation_error.hpp index 62fbef861..fcd89937c 100644 --- a/iceoryx2-ffi/cxx/include/iox2/config_creation_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/config_creation_error.hpp @@ -26,8 +26,6 @@ enum class ConfigCreationError : uint8_t { UnableToDeserializeContents }; -auto error_string(const iox2::ConfigCreationError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/connection_failure.hpp b/iceoryx2-ffi/cxx/include/iox2/connection_failure.hpp index 1f967a1a7..6a6c7d3cc 100644 --- a/iceoryx2-ffi/cxx/include/iox2/connection_failure.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/connection_failure.hpp @@ -26,9 +26,6 @@ enum class ConnectionFailure : uint8_t { UnableToMapPublishersDataSegment }; - -auto error_string(const iox2::ConnectionFailure& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp index 54af04053..59da1a9f7 100644 --- a/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp @@ -63,6 +63,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::SemanticStringError value) noexcept -> const + char* { + return iox2_semantic_string_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::ServiceType { const auto service_type = static_cast(value); @@ -115,6 +121,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::NodeCreationFailure value) noexcept -> const + char* { + return iox2_node_creation_failure_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::CallbackProgression { const auto error = static_cast(value); @@ -171,6 +183,11 @@ constexpr auto from(const iox2: IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::NodeListFailure value) noexcept -> const char* { + return iox2_node_list_failure_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::NodeWaitFailure { const auto error = static_cast(value); @@ -197,6 +214,11 @@ constexpr auto from(const iox2: IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::NodeWaitFailure value) noexcept -> const char* { + return iox2_node_wait_failure_string(iox::into(value)); +} + template <> constexpr auto from(const iox2::MessagingPattern value) noexcept -> iox2_messaging_pattern_e { @@ -256,6 +278,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ServiceDetailsError value) noexcept -> const + char* { + return iox2_service_details_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::EventOpenOrCreateError { const auto error = static_cast(value); @@ -356,6 +384,12 @@ constexpr auto from +constexpr auto +from(const iox2::EventOpenOrCreateError value) noexcept -> const char* { + return iox2_event_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::EventOpenError { const auto error = static_cast(value); @@ -426,6 +460,11 @@ constexpr auto from(con } } +template <> +constexpr auto from(const iox2::EventOpenError value) noexcept -> const char* { + return iox2_event_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::EventCreateError { const auto error = static_cast(value); @@ -470,6 +509,11 @@ constexpr auto from( } } +template <> +constexpr auto from(const iox2::EventCreateError value) noexcept -> const char* { + return iox2_event_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::PublishSubscribeOpenOrCreateError { @@ -617,6 +661,13 @@ constexpr auto from +constexpr auto +from(const iox2::PublishSubscribeOpenError value) noexcept -> const + char* { + return iox2_pub_sub_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::PublishSubscribeCreateError { @@ -664,6 +715,13 @@ constexpr auto from +constexpr auto +from(const iox2::PublishSubscribeCreateError value) noexcept -> const + char* { + return iox2_pub_sub_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from( const iox2::PublishSubscribeOpenOrCreateError value) noexcept -> iox2_pub_sub_open_or_create_error_e { @@ -723,6 +781,12 @@ constexpr auto from +constexpr auto from( + const iox2::PublishSubscribeOpenOrCreateError value) noexcept -> const char* { + return iox2_pub_sub_open_or_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::NotifierCreateError { const auto error = static_cast(value); @@ -745,6 +809,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::NotifierCreateError value) noexcept -> const + char* { + return iox2_notifier_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::ListenerCreateError { const auto error = static_cast(value); @@ -771,6 +841,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ListenerCreateError value) noexcept -> const + char* { + return iox2_listener_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::NotifierNotifyError { const auto error = static_cast(value); @@ -793,6 +869,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::NotifierNotifyError value) noexcept -> const + char* { + return iox2_notifier_notify_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::ListenerWaitError { const auto error = static_cast(value); @@ -823,6 +905,11 @@ constexpr auto from(const i IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ListenerWaitError value) noexcept -> const char* { + return iox2_listener_wait_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::PublisherCreateError { const auto error = static_cast(value); @@ -849,6 +936,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::PublisherCreateError value) noexcept -> const + char* { + return iox2_publisher_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::SubscriberCreateError { const auto error = static_cast(value); @@ -875,6 +968,12 @@ constexpr auto from IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::SubscriberCreateError value) noexcept -> const + char* { + return iox2_subscriber_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::PublisherSendError { const auto error = static_cast(value); @@ -921,6 +1020,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::PublisherSendError value) noexcept -> const + char* { + return iox2_publisher_send_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::SubscriberReceiveError { const auto error = static_cast(value); @@ -951,6 +1056,12 @@ constexpr auto from +constexpr auto +from(const iox2::SubscriberReceiveError value) noexcept -> const char* { + return iox2_subscriber_receive_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::PublisherLoanError { const auto error = static_cast(value); @@ -985,6 +1096,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::PublisherLoanError value) noexcept -> const + char* { + return iox2_publisher_loan_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::TypeVariant { const auto variant = static_cast(value); @@ -1024,6 +1141,11 @@ constexpr auto from(const iox IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ServiceListError value) noexcept -> const char* { + return iox2_service_list_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::MessagingPattern { const auto variant = static_cast(value); @@ -1088,6 +1210,11 @@ constexpr auto from(const io IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ConnectionFailure value) noexcept -> const char* { + return iox2_connection_failure_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::ConfigCreationError { const auto variant = static_cast(value); @@ -1121,6 +1248,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::ConfigCreationError value) noexcept -> const + char* { + return iox2_config_creation_error_string(iox::into(value)); +} + template <> constexpr auto from(iox2::LogLevel value) noexcept -> iox2_log_level_e { switch (value) { @@ -1183,6 +1316,12 @@ constexpr auto from( IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::WaitSetCreateError value) noexcept -> const + char* { + return iox2_waitset_create_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::WaitSetRunResult { const auto variant = static_cast(value); @@ -1247,6 +1386,12 @@ constexpr auto from +constexpr auto +from(const iox2::WaitSetAttachmentError value) noexcept -> const char* { + return iox2_waitset_attachment_error_string(iox::into(value)); +} + template <> constexpr auto from(const int value) noexcept -> iox2::WaitSetRunError { const auto variant = static_cast(value); @@ -1285,6 +1430,11 @@ constexpr auto from(const iox2: IOX_UNREACHABLE(); } +template <> +constexpr auto from(const iox2::WaitSetRunError value) noexcept -> const char* { + return iox2_waitset_run_error_string(iox::into(value)); +} + } // namespace iox #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/listener_error.hpp b/iceoryx2-ffi/cxx/include/iox2/listener_error.hpp index 61bea4130..ff02d038f 100644 --- a/iceoryx2-ffi/cxx/include/iox2/listener_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/listener_error.hpp @@ -42,9 +42,6 @@ enum class ListenerWaitError : uint8_t { InternalFailure, }; -auto error_string(const iox2::ListenerCreateError& error) -> const char*; -auto error_string(const iox2::ListenerWaitError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/node_failure_enums.hpp b/iceoryx2-ffi/cxx/include/iox2/node_failure_enums.hpp index d27a65eb8..0b6ab338c 100644 --- a/iceoryx2-ffi/cxx/include/iox2/node_failure_enums.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/node_failure_enums.hpp @@ -39,9 +39,6 @@ enum class NodeCreationFailure : uint8_t { enum class NodeCleanupFailure : uint8_t { }; -auto error_string(const iox2::NodeListFailure& error) -> const char*; -auto error_string(const iox2::NodeCreationFailure& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/node_wait_failure.hpp b/iceoryx2-ffi/cxx/include/iox2/node_wait_failure.hpp index cec0feae2..fdcd0f485 100644 --- a/iceoryx2-ffi/cxx/include/iox2/node_wait_failure.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/node_wait_failure.hpp @@ -25,9 +25,6 @@ enum class NodeWaitFailure : uint8_t { Interrupt, }; - -auto error_string(const iox2::NodeWaitFailure& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/notifier_error.hpp b/iceoryx2-ffi/cxx/include/iox2/notifier_error.hpp index 8cf0c4069..ae55afb6c 100644 --- a/iceoryx2-ffi/cxx/include/iox2/notifier_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/notifier_error.hpp @@ -36,9 +36,6 @@ enum class NotifierNotifyError : uint8_t { EventIdOutOfBounds, }; -auto error_string(const iox2::NotifierCreateError& error) -> const char*; -auto error_string(const iox2::NotifierNotifyError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/publisher_error.hpp b/iceoryx2-ffi/cxx/include/iox2/publisher_error.hpp index cda7b80dc..9050b9659 100644 --- a/iceoryx2-ffi/cxx/include/iox2/publisher_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/publisher_error.hpp @@ -83,10 +83,6 @@ enum class PublisherSendError : uint8_t { ConnectionError, }; -auto error_string(const iox2::PublisherCreateError& error) -> const char*; -auto error_string(const iox2::PublisherLoanError& error) -> const char*; -auto error_string(const iox2::PublisherSendError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/semantic_string.hpp b/iceoryx2-ffi/cxx/include/iox2/semantic_string.hpp index dd243032d..f40634546 100644 --- a/iceoryx2-ffi/cxx/include/iox2/semantic_string.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/semantic_string.hpp @@ -24,9 +24,6 @@ enum class SemanticStringError : uint8_t { ExceedsMaximumLength }; - -auto error_string(const iox2::SemanticStringError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/service_builder_event_error.hpp b/iceoryx2-ffi/cxx/include/iox2/service_builder_event_error.hpp index b4c0bd1bf..6fce97a59 100644 --- a/iceoryx2-ffi/cxx/include/iox2/service_builder_event_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/service_builder_event_error.hpp @@ -158,10 +158,6 @@ enum class EventOpenOrCreateError : uint8_t { CreateOldConnectionsStillActive, }; -auto error_string(const iox2::EventOpenError& error) -> const char*; -auto error_string(const iox2::EventCreateError& error) -> const char*; -auto error_string(const iox2::EventOpenOrCreateError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/service_builder_publish_subscribe_error.hpp b/iceoryx2-ffi/cxx/include/iox2/service_builder_publish_subscribe_error.hpp index d3867bb74..cf4c5af4a 100644 --- a/iceoryx2-ffi/cxx/include/iox2/service_builder_publish_subscribe_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/service_builder_publish_subscribe_error.hpp @@ -176,10 +176,6 @@ enum class PublishSubscribeOpenOrCreateError : uint8_t { CreateHangsInCreation, }; -auto error_string(const iox2::PublishSubscribeOpenError& error) -> const char*; -auto error_string(const iox2::PublishSubscribeCreateError& error) -> const char*; -auto error_string(const iox2::PublishSubscribeOpenOrCreateError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/service_error_enums.hpp b/iceoryx2-ffi/cxx/include/iox2/service_error_enums.hpp index e24b2e482..3f2b1466b 100644 --- a/iceoryx2-ffi/cxx/include/iox2/service_error_enums.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/service_error_enums.hpp @@ -44,9 +44,6 @@ enum class ServiceListError : uint8_t { InternalError, }; -auto error_string(const iox2::ServiceDetailsError& error) -> const char*; -auto error_string(const iox2::ServiceListError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/subscriber_error.hpp b/iceoryx2-ffi/cxx/include/iox2/subscriber_error.hpp index 6e8b46da3..b0e5a6576 100644 --- a/iceoryx2-ffi/cxx/include/iox2/subscriber_error.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/subscriber_error.hpp @@ -44,9 +44,6 @@ enum class SubscriberCreateError : uint8_t { BufferSizeExceedsMaxSupportedBufferSizeOfService, }; -auto error_string(const iox2::SubscriberCreateError& error) -> const char*; -auto error_string(const iox2::SubscriberReceiveError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/include/iox2/waitset_enums.hpp b/iceoryx2-ffi/cxx/include/iox2/waitset_enums.hpp index 991651adf..3b7931a24 100644 --- a/iceoryx2-ffi/cxx/include/iox2/waitset_enums.hpp +++ b/iceoryx2-ffi/cxx/include/iox2/waitset_enums.hpp @@ -59,11 +59,6 @@ enum class WaitSetRunError : uint8_t { Interrupt }; -auto error_string(const iox2::WaitSetCreateError& error) -> const char*; -auto error_string(const iox2::WaitSetRunResult& error) -> const char*; -auto error_string(const iox2::WaitSetAttachmentError& error) -> const char*; -auto error_string(const iox2::WaitSetRunError& error) -> const char*; - } // namespace iox2 #endif diff --git a/iceoryx2-ffi/cxx/src/error_string.cpp b/iceoryx2-ffi/cxx/src/error_string.cpp deleted file mode 100644 index 56f54b473..000000000 --- a/iceoryx2-ffi/cxx/src/error_string.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2024 Contributors to the Eclipse Foundation -// -// See the NOTICE file(s) distributed with this work for additional -// information regarding copyright ownership. -// -// This program and the accompanying materials are made available under the -// terms of the Apache Software License 2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license -// which is available at https://opensource.org/licenses/MIT. -// -// SPDX-License-Identifier: Apache-2.0 OR MIT - -#include "iox2/config_creation_error.hpp" -#include "iox2/connection_failure.hpp" -#include "iox2/enum_translation.hpp" -#include "iox2/iceoryx2.h" -#include "iox2/listener_error.hpp" -#include "iox2/node_failure_enums.hpp" -#include "iox2/node_wait_failure.hpp" -#include "iox2/notifier_error.hpp" -#include "iox2/publisher_error.hpp" -#include "iox2/semantic_string.hpp" -#include "iox2/service_builder_event_error.hpp" -#include "iox2/service_builder_publish_subscribe_error.hpp" -#include "iox2/service_error_enums.hpp" -#include "iox2/subscriber_error.hpp" -#include "iox2/waitset_enums.hpp" - -namespace iox2 { - -auto error_string(const iox2::ConfigCreationError& error) -> const char* { - return iox2_config_creation_error_string(iox::into(error)); -} - -auto error_string(const iox2::ConnectionFailure& error) -> const char* { - return iox2_connection_failure_string(iox::into(error)); -} - -auto error_string(const iox2::ServiceDetailsError& error) -> const char* { - return iox2_service_details_error_string(iox::into(error)); -} - -auto error_string(const iox2::ServiceListError& error) -> const char* { - return iox2_service_list_error_string(iox::into(error)); -} - -auto error_string(const iox2::ListenerCreateError& error) -> const char* { - return iox2_listener_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::ListenerWaitError& error) -> const char* { - return iox2_listener_wait_error_string(iox::into(error)); -} - -auto error_string(const iox2::NodeListFailure& error) -> const char* { - return iox2_node_list_failure_string(iox::into(error)); -} - -auto error_string(const iox2::NodeCreationFailure& error) -> const char* { - return iox2_node_creation_failure_string(iox::into(error)); -} - -auto error_string(const iox2::NodeWaitFailure& error) -> const char* { - return iox2_node_wait_failure_string(iox::into(error)); -} - -auto error_string(const iox2::NotifierCreateError& error) -> const char* { - return iox2_notifier_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::NotifierNotifyError& error) -> const char* { - return iox2_notifier_notify_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublisherCreateError& error) -> const char* { - return iox2_publisher_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublisherLoanError& error) -> const char* { - return iox2_publisher_loan_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublisherSendError& error) -> const char* { - return iox2_publisher_send_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublishSubscribeOpenError& error) -> const char* { - return iox2_pub_sub_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublishSubscribeCreateError& error) -> const char* { - return iox2_pub_sub_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::PublishSubscribeOpenOrCreateError& error) -> const char* { - return iox2_pub_sub_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::SemanticStringError& error) -> const char* { - return iox2_semantic_string_error_string(iox::into(error)); -} - -auto error_string(const iox2::EventOpenError& error) -> const char* { - return iox2_event_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::EventCreateError& error) -> const char* { - return iox2_event_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::EventOpenOrCreateError& error) -> const char* { - return iox2_event_open_or_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::SubscriberCreateError& error) -> const char* { - return iox2_subscriber_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::SubscriberReceiveError& error) -> const char* { - return iox2_subscriber_receive_error_string(iox::into(error)); -} - -auto error_string(const iox2::WaitSetCreateError& error) -> const char* { - return iox2_waitset_create_error_string(iox::into(error)); -} - -auto error_string(const iox2::WaitSetAttachmentError& error) -> const char* { - return iox2_waitset_attachment_error_string(iox::into(error)); -} - -auto error_string(const iox2::WaitSetRunError& error) -> const char* { - return iox2_waitset_run_error_string(iox::into(error)); -} - -} // namespace iox2 diff --git a/iceoryx2-ffi/cxx/tests/src/enum_conversion_tests.cpp b/iceoryx2-ffi/cxx/tests/src/enum_conversion_tests.cpp new file mode 100644 index 000000000..e9c32fbb6 --- /dev/null +++ b/iceoryx2-ffi/cxx/tests/src/enum_conversion_tests.cpp @@ -0,0 +1,280 @@ +// Copyright (c) 2024 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available under the +// terms of the Apache Software License 2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license +// which is available at https://opensource.org/licenses/MIT. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT + +#include "test.hpp" + +#include "iox2/config_creation_error.hpp" +#include "iox2/connection_failure.hpp" +#include "iox2/listener_error.hpp" +#include "iox2/node_failure_enums.hpp" +#include "iox2/node_wait_failure.hpp" +#include "iox2/notifier_error.hpp" +#include "iox2/publisher_error.hpp" +#include "iox2/service_builder_event_error.hpp" +#include "iox2/service_builder_publish_subscribe_error.hpp" +#include "iox2/service_error_enums.hpp" +#include "iox2/subscriber_error.hpp" +#include "iox2/waitset_enums.hpp" + +namespace { + +TEST(EnumConversionTest, config_creation_into_c_str) { + using Sut = iox2::ConfigCreationError; + ASSERT_GT(strlen(iox::into(Sut::FailedToOpenConfigFile)), 1U); + ASSERT_GT(strlen(iox::into(Sut::UnableToDeserializeContents)), 1U); + ASSERT_GT(strlen(iox::into(Sut::FailedToReadConfigFileContents)), 1U); +} + +TEST(EnumConversionTest, connection_failure_into_c_str) { + using Sut = iox2::ConnectionFailure; + ASSERT_GT(strlen(iox::into(Sut::FailedToEstablishConnection)), 1U); + ASSERT_GT(strlen(iox::into(Sut::UnableToMapPublishersDataSegment)), 1U); +} + +TEST(EnumConversionTest, listener_create_into_c_str) { + using Sut = iox2::ListenerCreateError; + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxSupportedListeners)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ResourceCreationFailed)), 1U); +} + +TEST(EnumConversionTest, listener_wait_into_c_str) { + using Sut = iox2::ListenerWaitError; + ASSERT_GT(strlen(iox::into(Sut::ContractViolation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InterruptSignal)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); +} + +TEST(EnumConversionTest, node_list_failure_into_c_str) { + using Sut = iox2::NodeListFailure; + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); + ASSERT_GT(strlen(iox::into(Sut::Interrupt)), 1U); +} + +TEST(EnumConversionTest, node_creation_failure_into_c_str) { + using Sut = iox2::NodeCreationFailure; + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); +} + +TEST(EnumConversionTest, node_wait_failure_into_c_str) { + using Sut = iox2::NodeWaitFailure; + ASSERT_GT(strlen(iox::into(Sut::TerminationRequest)), 1U); + ASSERT_GT(strlen(iox::into(Sut::Interrupt)), 1U); +} + +TEST(EnumConversionTest, notifier_create_into_c_str) { + using Sut = iox2::NotifierCreateError; + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxSupportedNotifiers)), 1U); +} + +TEST(EnumConversionTest, notifier_notify_into_c_str) { + using Sut = iox2::NotifierNotifyError; + ASSERT_GT(strlen(iox::into(Sut::EventIdOutOfBounds)), 1U); +} + +TEST(EnumConversionTest, publisher_create_into_c_str) { + using Sut = iox2::PublisherCreateError; + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxSupportedPublishers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::UnableToCreateDataSegment)), 1U); +} + +TEST(EnumConversionTest, publisher_loan_into_c_str) { + using Sut = iox2::PublisherLoanError; + ASSERT_GT(strlen(iox::into(Sut::OutOfMemory)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxLoanedSamples)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxLoanSize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); +} + +TEST(EnumConversionTest, publisher_send_into_c_str) { + using Sut = iox2::PublisherSendError; + ASSERT_GT(strlen(iox::into(Sut::ConnectionBrokenSincePublisherNoLongerExists)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ConnectionCorrupted)), 1U); + ASSERT_GT(strlen(iox::into(Sut::LoanErrorOutOfMemory)), 1U); + ASSERT_GT(strlen(iox::into(Sut::LoanErrorExceedsMaxLoanedSamples)), 1U); + ASSERT_GT(strlen(iox::into(Sut::LoanErrorExceedsMaxLoanSize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::LoanErrorInternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ConnectionError)), 1U); +} + +TEST(EnumConversionTest, event_open_into_c_str) { + using Sut = iox2::EventOpenError; + ASSERT_GT(strlen(iox::into(Sut::DoesNotExist)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleMessagingPattern)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleAttributes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::HangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfNotifiers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfListeners)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedMaxEventId)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxNumberOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IsMarkedForDestruction)), 1U); +} + +TEST(EnumConversionTest, event_create_into_c_str) { + using Sut = iox2::EventCreateError; + ASSERT_GT(strlen(iox::into(Sut::ServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IsBeingCreatedByAnotherInstance)), 1U); + ASSERT_GT(strlen(iox::into(Sut::AlreadyExists)), 1U); + ASSERT_GT(strlen(iox::into(Sut::HangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OldConnectionsStillActive)), 1U); +} + +TEST(EnumConversionTest, event_open_or_create_into_c_str) { + using Sut = iox2::EventOpenOrCreateError; + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotExist)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenInsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleMessagingPattern)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleAttributes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenInternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenHangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfNotifiers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfListeners)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedMaxEventId)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenExceedsMaxNumberOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIsMarkedForDestruction)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateInternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateIsBeingCreatedByAnotherInstance)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateAlreadyExists)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateHangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateInsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateOldConnectionsStillActive)), 1U); +} + +TEST(EnumConversionTest, publish_subscribe_open_into_c_str) { + using Sut = iox2::PublishSubscribeOpenError; + ASSERT_GT(strlen(iox::into(Sut::DoesNotExist)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleTypes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleMessagingPattern)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleAttributes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedMinBufferSize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedMinHistorySize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedMinSubscriberBorrowedSamples)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfPublishers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfSubscribers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::DoesNotSupportRequestedAmountOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IncompatibleOverflowBehavior)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::HangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxNumberOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IsMarkedForDestruction)), 1U); +} + +TEST(EnumConversionTest, publish_subscribe_create_into_c_str) { + using Sut = iox2::PublishSubscribeCreateError; + ASSERT_GT(strlen(iox::into(Sut::ServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::SubscriberBufferMustBeLargerThanHistorySize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::AlreadyExists)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::IsBeingCreatedByAnotherInstance)), 1U); + ASSERT_GT(strlen(iox::into(Sut::HangsInCreation)), 1U); +} + +TEST(EnumConversionTest, publish_subscribe_open_or_create_into_c_str) { + using Sut = iox2::PublishSubscribeOpenOrCreateError; + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotExist)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenInternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleTypes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleMessagingPattern)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleAttributes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedMinBufferSize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedMinHistorySize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedMinSubscriberBorrowedSamples)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfPublishers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfSubscribers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenDoesNotSupportRequestedAmountOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIncompatibleOverflowBehavior)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenInsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenHangsInCreation)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenExceedsMaxNumberOfNodes)), 1U); + ASSERT_GT(strlen(iox::into(Sut::OpenIsMarkedForDestruction)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateServiceInCorruptedState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateSubscriberBufferMustBeLargerThanHistorySize)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateAlreadyExists)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateInsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateInternalFailure)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateIsBeingCreatedByAnotherInstance)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateOldConnectionsStillActive)), 1U); + ASSERT_GT(strlen(iox::into(Sut::CreateHangsInCreation)), 1U); +} + +TEST(EnumConversionTest, service_details_into_c_str) { + using Sut = iox2::ServiceDetailsError; + ASSERT_GT(strlen(iox::into(Sut::FailedToOpenStaticServiceInfo)), 1U); + ASSERT_GT(strlen(iox::into(Sut::FailedToReadStaticServiceInfo)), 1U); + ASSERT_GT(strlen(iox::into(Sut::FailedToDeserializeStaticServiceInfo)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ServiceInInconsistentState)), 1U); + ASSERT_GT(strlen(iox::into(Sut::VersionMismatch)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); + ASSERT_GT(strlen(iox::into(Sut::FailedToAcquireNodeState)), 1U); +} + +TEST(EnumConversionTest, service_list_into_c_str) { + using Sut = iox2::ServiceListError; + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); +} + +TEST(EnumConversionTest, subscriber_receive_into_c_str) { + using Sut = iox2::SubscriberReceiveError; + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxBorrowedSamples)), 1U); + ASSERT_GT(strlen(iox::into(Sut::FailedToEstablishConnection)), 1U); + ASSERT_GT(strlen(iox::into(Sut::UnableToMapPublishersDataSegment)), 1U); +} + +TEST(EnumConversionTest, subscriber_create_into_c_str) { + using Sut = iox2::SubscriberCreateError; + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaxSupportedSubscribers)), 1U); + ASSERT_GT(strlen(iox::into(Sut::BufferSizeExceedsMaxSupportedBufferSizeOfService)), 1U); +} + +TEST(EnumConversionTest, waitset_create_into_c_str) { + using Sut = iox2::WaitSetCreateError; + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); +} + +TEST(EnumConversionTest, waitset_attachment_into_c_str) { + using Sut = iox2::WaitSetAttachmentError; + ASSERT_GT(strlen(iox::into(Sut::InsufficientCapacity)), 1U); + ASSERT_GT(strlen(iox::into(Sut::AlreadyAttached)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); +} + +TEST(EnumConversionTest, waitset_run_into_c_str) { + using Sut = iox2::WaitSetRunError; + ASSERT_GT(strlen(iox::into(Sut::InsufficientPermissions)), 1U); + ASSERT_GT(strlen(iox::into(Sut::InternalError)), 1U); + ASSERT_GT(strlen(iox::into(Sut::NoAttachments)), 1U); + ASSERT_GT(strlen(iox::into(Sut::TerminationRequest)), 1U); + ASSERT_GT(strlen(iox::into(Sut::Interrupt)), 1U); +} + +TEST(EnumConversionTest, semantic_string_into_c_str) { + using Sut = iox2::SemanticStringError; + ASSERT_GT(strlen(iox::into(Sut::InvalidContent)), 1U); + ASSERT_GT(strlen(iox::into(Sut::ExceedsMaximumLength)), 1U); +} + +} // namespace diff --git a/iceoryx2-ffi/cxx/tests/src/error_string_tests.cpp b/iceoryx2-ffi/cxx/tests/src/error_string_tests.cpp deleted file mode 100644 index 2fe5e05ce..000000000 --- a/iceoryx2-ffi/cxx/tests/src/error_string_tests.cpp +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) 2024 Contributors to the Eclipse Foundation -// -// See the NOTICE file(s) distributed with this work for additional -// information regarding copyright ownership. -// -// This program and the accompanying materials are made available under the -// terms of the Apache Software License 2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license -// which is available at https://opensource.org/licenses/MIT. -// -// SPDX-License-Identifier: Apache-2.0 OR MIT - -#include "test.hpp" - -#include "iox2/config_creation_error.hpp" -#include "iox2/connection_failure.hpp" -#include "iox2/listener_error.hpp" -#include "iox2/node_failure_enums.hpp" -#include "iox2/node_wait_failure.hpp" -#include "iox2/notifier_error.hpp" -#include "iox2/publisher_error.hpp" -#include "iox2/service_builder_event_error.hpp" -#include "iox2/service_builder_publish_subscribe_error.hpp" -#include "iox2/service_error_enums.hpp" -#include "iox2/subscriber_error.hpp" -#include "iox2/waitset_enums.hpp" - -namespace { - -using iox2::error_string; - -TEST(ErrorStringTest, config_creation_error_string) { - using Sut = iox2::ConfigCreationError; - ASSERT_GT(strlen(error_string(Sut::FailedToOpenConfigFile)), 1U); - ASSERT_GT(strlen(error_string(Sut::UnableToDeserializeContents)), 1U); - ASSERT_GT(strlen(error_string(Sut::FailedToReadConfigFileContents)), 1U); -} - -TEST(ErrorStringTest, connection_failure_string) { - using Sut = iox2::ConnectionFailure; - ASSERT_GT(strlen(error_string(Sut::FailedToEstablishConnection)), 1U); - ASSERT_GT(strlen(error_string(Sut::UnableToMapPublishersDataSegment)), 1U); -} - -TEST(ErrorStringTest, listener_create_error_string) { - using Sut = iox2::ListenerCreateError; - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxSupportedListeners)), 1U); - ASSERT_GT(strlen(error_string(Sut::ResourceCreationFailed)), 1U); -} - -TEST(ErrorStringTest, listener_wait_error_string) { - using Sut = iox2::ListenerWaitError; - ASSERT_GT(strlen(error_string(Sut::ContractViolation)), 1U); - ASSERT_GT(strlen(error_string(Sut::InterruptSignal)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); -} - -TEST(ErrorStringTest, node_list_failure_string) { - using Sut = iox2::NodeListFailure; - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); - ASSERT_GT(strlen(error_string(Sut::Interrupt)), 1U); -} - -TEST(ErrorStringTest, node_creation_failure_string) { - using Sut = iox2::NodeCreationFailure; - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); -} - -TEST(ErrorStringTest, node_wait_failure_string) { - using Sut = iox2::NodeWaitFailure; - ASSERT_GT(strlen(error_string(Sut::TerminationRequest)), 1U); - ASSERT_GT(strlen(error_string(Sut::Interrupt)), 1U); -} - -TEST(ErrorStringTest, notifier_create_error_string) { - using Sut = iox2::NotifierCreateError; - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxSupportedNotifiers)), 1U); -} - -TEST(ErrorStringTest, notifier_notify_error_string) { - using Sut = iox2::NotifierNotifyError; - ASSERT_GT(strlen(error_string(Sut::EventIdOutOfBounds)), 1U); -} - -TEST(ErrorStringTest, publisher_create_error_string) { - using Sut = iox2::PublisherCreateError; - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxSupportedPublishers)), 1U); - ASSERT_GT(strlen(error_string(Sut::UnableToCreateDataSegment)), 1U); -} - -TEST(ErrorStringTest, publisher_loan_error_string) { - using Sut = iox2::PublisherLoanError; - ASSERT_GT(strlen(error_string(Sut::OutOfMemory)), 1U); - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxLoanedSamples)), 1U); - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxLoanSize)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); -} - -TEST(ErrorStringTest, publisher_send_error_string) { - using Sut = iox2::PublisherSendError; - ASSERT_GT(strlen(error_string(Sut::ConnectionBrokenSincePublisherNoLongerExists)), 1U); - ASSERT_GT(strlen(error_string(Sut::ConnectionCorrupted)), 1U); - ASSERT_GT(strlen(error_string(Sut::LoanErrorOutOfMemory)), 1U); - ASSERT_GT(strlen(error_string(Sut::LoanErrorExceedsMaxLoanedSamples)), 1U); - ASSERT_GT(strlen(error_string(Sut::LoanErrorExceedsMaxLoanSize)), 1U); - ASSERT_GT(strlen(error_string(Sut::LoanErrorInternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::ConnectionError)), 1U); -} - -TEST(ErrorStringTest, event_open_error_string) { - using Sut = iox2::EventOpenError; - ASSERT_GT(strlen(error_string(Sut::DoesNotExist)), 1U); - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::ServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleMessagingPattern)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleAttributes)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::HangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfNotifiers)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfListeners)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedMaxEventId)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxNumberOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::IsMarkedForDestruction)), 1U); -} - -TEST(ErrorStringTest, event_create_error_string) { - using Sut = iox2::EventCreateError; - ASSERT_GT(strlen(error_string(Sut::ServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::IsBeingCreatedByAnotherInstance)), 1U); - ASSERT_GT(strlen(error_string(Sut::AlreadyExists)), 1U); - ASSERT_GT(strlen(error_string(Sut::HangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::OldConnectionsStillActive)), 1U); -} - -TEST(ErrorStringTest, event_open_or_create_error_string) { - using Sut = iox2::EventOpenOrCreateError; - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotExist)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenInsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleMessagingPattern)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleAttributes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenInternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenHangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfNotifiers)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfListeners)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedMaxEventId)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenExceedsMaxNumberOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIsMarkedForDestruction)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateInternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateIsBeingCreatedByAnotherInstance)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateAlreadyExists)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateHangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateInsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateOldConnectionsStillActive)), 1U); -} - -TEST(ErrorStringTest, publish_subscribe_open_error_string) { - using Sut = iox2::PublishSubscribeOpenError; - ASSERT_GT(strlen(error_string(Sut::DoesNotExist)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleTypes)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleMessagingPattern)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleAttributes)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedMinBufferSize)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedMinHistorySize)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedMinSubscriberBorrowedSamples)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfPublishers)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfSubscribers)), 1U); - ASSERT_GT(strlen(error_string(Sut::DoesNotSupportRequestedAmountOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::IncompatibleOverflowBehavior)), 1U); - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::ServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::HangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxNumberOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::IsMarkedForDestruction)), 1U); -} - -TEST(ErrorStringTest, publish_subscribe_create_error_string) { - using Sut = iox2::PublishSubscribeCreateError; - ASSERT_GT(strlen(error_string(Sut::ServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::SubscriberBufferMustBeLargerThanHistorySize)), 1U); - ASSERT_GT(strlen(error_string(Sut::AlreadyExists)), 1U); - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::IsBeingCreatedByAnotherInstance)), 1U); - ASSERT_GT(strlen(error_string(Sut::HangsInCreation)), 1U); -} - -TEST(ErrorStringTest, publish_subscribe_open_or_create_error_string) { - using Sut = iox2::PublishSubscribeOpenOrCreateError; - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotExist)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenInternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleTypes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleMessagingPattern)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleAttributes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedMinBufferSize)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedMinHistorySize)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedMinSubscriberBorrowedSamples)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfPublishers)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfSubscribers)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenDoesNotSupportRequestedAmountOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIncompatibleOverflowBehavior)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenInsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenHangsInCreation)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenExceedsMaxNumberOfNodes)), 1U); - ASSERT_GT(strlen(error_string(Sut::OpenIsMarkedForDestruction)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateServiceInCorruptedState)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateSubscriberBufferMustBeLargerThanHistorySize)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateAlreadyExists)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateInsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateInternalFailure)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateIsBeingCreatedByAnotherInstance)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateOldConnectionsStillActive)), 1U); - ASSERT_GT(strlen(error_string(Sut::CreateHangsInCreation)), 1U); -} - -TEST(ErrorStringTest, service_details_error_string) { - using Sut = iox2::ServiceDetailsError; - ASSERT_GT(strlen(error_string(Sut::FailedToOpenStaticServiceInfo)), 1U); - ASSERT_GT(strlen(error_string(Sut::FailedToReadStaticServiceInfo)), 1U); - ASSERT_GT(strlen(error_string(Sut::FailedToDeserializeStaticServiceInfo)), 1U); - ASSERT_GT(strlen(error_string(Sut::ServiceInInconsistentState)), 1U); - ASSERT_GT(strlen(error_string(Sut::VersionMismatch)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); - ASSERT_GT(strlen(error_string(Sut::FailedToAcquireNodeState)), 1U); -} - -TEST(ErrorStringTest, service_list_error_string) { - using Sut = iox2::ServiceListError; - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); -} - -TEST(ErrorStringTest, subscriber_receive_error_string) { - using Sut = iox2::SubscriberReceiveError; - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxBorrowedSamples)), 1U); - ASSERT_GT(strlen(error_string(Sut::FailedToEstablishConnection)), 1U); - ASSERT_GT(strlen(error_string(Sut::UnableToMapPublishersDataSegment)), 1U); -} - -TEST(ErrorStringTest, subscriber_create_error_string) { - using Sut = iox2::SubscriberCreateError; - ASSERT_GT(strlen(error_string(Sut::ExceedsMaxSupportedSubscribers)), 1U); - ASSERT_GT(strlen(error_string(Sut::BufferSizeExceedsMaxSupportedBufferSizeOfService)), 1U); -} - -TEST(ErrorStringTest, waitset_create_error_string) { - using Sut = iox2::WaitSetCreateError; - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); -} - -TEST(ErrorStringTest, waitset_attachment_error_string) { - using Sut = iox2::WaitSetAttachmentError; - ASSERT_GT(strlen(error_string(Sut::InsufficientCapacity)), 1U); - ASSERT_GT(strlen(error_string(Sut::AlreadyAttached)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); -} - -TEST(ErrorStringTest, waitset_run_error_string) { - using Sut = iox2::WaitSetRunError; - ASSERT_GT(strlen(error_string(Sut::InsufficientPermissions)), 1U); - ASSERT_GT(strlen(error_string(Sut::InternalError)), 1U); - ASSERT_GT(strlen(error_string(Sut::NoAttachments)), 1U); - ASSERT_GT(strlen(error_string(Sut::TerminationRequest)), 1U); - ASSERT_GT(strlen(error_string(Sut::Interrupt)), 1U); -} - -} // namespace