4#include <catch2/catch_all.hpp>
5TEST_CASE(
"bool(ParserResult)",
"[Protocol][Protocol::Parser]")
18TEST_CASE(
"ParserResult::isMessage()",
"[Protocol][Protocol::Parser]")
31TEST_CASE(
"ParserResult::isError()",
"[Protocol][Protocol::Parser]")
44TEST_CASE(
"ParserResult<Assignment>::getMessage()",
"[Protocol][Protocol::Parser]")
46 auto value = GENERATE(
51 auto identifier = GENERATE(
52 "x",
"it",
"long_identifier",
"sequence_identifier[4]",
"nested_sequence_identifier[4][423]");
56 auto expectedIdentifier = identifier;
57 auto expected_value =
value;
62 CHECK(
result.getMessage().identifier == expectedIdentifier);
66TEST_CASE(
"ParserResult<Inquiry>::getMessage()",
"[Protocol][Protocol::Parser]")
68 auto identifier = GENERATE(
69 "x",
"it",
"long_identifier",
"sequence_identifier[4]",
"nested_sequence_identifier[4][423]");
73 auto expectedIdentifier = identifier;
78 CHECK(
result.getMessage().identifier == expectedIdentifier);
81TEST_CASE(
"ParserResult<Command>::getMessage()",
"[Protocol][Protocol::Parser]")
83 auto identifier = GENERATE(
84 "x",
"it",
"long_identifier",
"sequence_identifier[4]",
"nested_sequence_identifier[4][423]");
88 auto expectedIdentifier = identifier;
93 CHECK(
result.getMessage().identifier == expectedIdentifier);
96TEST_CASE(
"ParserResult<T>::getError()",
"[Protocol][Protocol::Parser]")
98 auto errorMessage = GENERATE(
"invalid syntax",
"unknown identifier",
"unexpected character");
99 auto expectedErrorMessage = errorMessage;
Wrapper for the result of a protocol parsing attempt.
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
Encapsulates the result of a protocol parsing operation.
Represents an assignment operation in the protocol.
Represents a command invocation in the protocol.
Represents a value inquiry in the protocol.
CHECK(m.identifier==identifier)
CHECK_FALSE(m.hasDouble())
irsol::protocol::Assignment m(identifier, value)