9#include <catch2/catch_all.hpp>
18 return std::string_view(a) == b;
21TEST_CASE(
"InMessageKindToString()",
"[Protocol][Protocol::Message]")
24 auto [messageKind,
expected] = GENERATE(
47TEST_CASE(
"OutMessageKindToString()",
"[Protocol][Protocol::Message]")
50 auto [messageKind,
expected] = GENERATE(
84TEST_CASE(
"getInMessageKind<direct>()",
"[Protocol][Protocol::Message]")
101TEST_CASE(
"getInMessageKind<variant>()",
"[Protocol][Protocol::Message]")
117TEST_CASE(
"isAssignment<direct>()",
"[Protocol][Protocol::Message]")
133TEST_CASE(
"isAssignment<variant>()",
"[Protocol][Protocol::Message]")
149TEST_CASE(
"isInquiry<direct>()",
"[Protocol][Protocol::Message]")
165TEST_CASE(
"isInquiry<variant>()",
"[Protocol][Protocol::Message]")
181TEST_CASE(
"isCommand<direct>()",
"[Protocol][Protocol::Message]")
197TEST_CASE(
"isCommand<variant>()",
"[Protocol][Protocol::Message]")
212TEST_CASE(
"getOutMessageKind<direct>()",
"[Protocol][Protocol::Message]")
219 std::vector<irsol::types::byte_t> data(
226 std::vector<irsol::types::byte_t> data(
233 std::vector<irsol::types::byte_t> data(
244TEST_CASE(
"getOutMessageKind<variant>()",
"[Protocol][Protocol::Message]")
252 std::vector<irsol::types::byte_t> data(
261 std::vector<irsol::types::byte_t> data(
269 std::vector<irsol::types::byte_t> data(
283TEST_CASE(
"isSuccess<direct>()",
"[Protocol][Protocol::Message]")
306TEST_CASE(
"isSuccess<variant>()",
"[Protocol][Protocol::Message]")
332TEST_CASE(
"isBinaryDataBuffer<direct>()",
"[Protocol][Protocol::Message]")
356TEST_CASE(
"isBinaryDataBuffer<variant>()",
"[Protocol][Protocol::Message]")
382TEST_CASE(
"isImageBinaryData<direct>()",
"[Protocol][Protocol::Message]")
406TEST_CASE(
"isImageBinaryData<variant>()",
"[Protocol][Protocol::Message]")
432TEST_CASE(
"isColorImageBinaryData<direct>()",
"[Protocol][Protocol::Message]")
456TEST_CASE(
"isColorImageBinaryData<variant>()",
"[Protocol][Protocol::Message]")
482TEST_CASE(
"isError<direct>()",
"[Protocol][Protocol::Message]")
506TEST_CASE(
"isError<variant>()",
"[Protocol][Protocol::Message]")
Protocol assignment operation representation.
Protocol binary data types and attributes definitions.
Protocol command representation.
Protocol error message representation.
constexpr bool isError(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is Error.
std::variant< Assignment, Inquiry, Command > InMessage
Variant type representing any incoming message.
constexpr OutMessageKind getOutMessageKind(IRSOL_MAYBE_UNUSED const T &msg)
Returns the OutMessageKind enum value corresponding to a given outgoing message type.
constexpr bool isCommand(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is a Command.
constexpr const char * OutMessageKindToString(OutMessageKind kind)
Converts an OutMessageKind enum to a human-readable string.
constexpr bool isSuccess(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is Success.
constexpr bool isColorImageBinaryData(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is ColorImageBinaryData.
constexpr bool isInquiry(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is an Inquiry.
constexpr bool isBinaryDataBuffer(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is BinaryDataBuffer.
constexpr bool isAssignment(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is an Assignment.
constexpr bool isImageBinaryData(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is ImageBinaryData (black & white).
constexpr const char * InMessageKindToString(InMessageKind kind)
Converts an InMessageKind enum to a human-readable string.
std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > OutMessage
Variant type representing any outgoing message.
constexpr InMessageKind getInMessageKind(IRSOL_MAYBE_UNUSED const T &msg)
Returns the InMessageKind enum value corresponding to a given incoming message type.
Protocol inquiry representation.
Represents an assignment operation in the protocol.
Represents a command invocation in the protocol.
static Error from(const T &msg, const std::string &description)
Creates an error from a specific incoming message type.
Represents a value inquiry in the protocol.
static Success from(const Assignment &msg, std::optional< irsol::types::protocol_value_t > overrideValue=std::nullopt)
Creates a success message from an Assignment.
Represents a binary data object within the protocol.
static constexpr uint8_t BYTES_PER_ELEMENT
Number of bytes per element.
Protocol success message representation.
CHECK(m.identifier==identifier)
CHECK_FALSE(m.hasDouble())
irsol::protocol::Assignment m(identifier, value)
std::vector< std::string > expected
constexpr bool strings_equal(char const *a, char const *b)
Definitions and utilities for incoming and outgoing protocol messages.