IRSOL
C++ code implementing socket server for interacting with Baumer camera.
test_error.cpp
Go to the documentation of this file.
2
3#include <catch2/catch_all.hpp>
4#include <memory>
5#include <string>
6
7TEST_CASE("Error::from<T>()", "[Protocol][Protocol::Message]")
8{
9 auto identifier = GENERATE("x", "it", "long_identifier");
10 auto description = GENERATE("hello world", "error description");
11 {
12 auto value = GENERATE(
18 CHECK(result.identifier == identifier);
20 CHECK(result.description == description);
21 }
22 {
23 irsol::protocol::Inquiry inquiry{identifier};
25 CHECK(result.identifier == identifier);
27 CHECK(result.description == description);
28 }
29 {
30 irsol::protocol::Command command{identifier};
32 CHECK(result.identifier == identifier);
34 CHECK(result.description == description);
35 }
36}
37
38TEST_CASE("Error::from<InMessage>()", "[Protocol][Protocol::Message]")
39{
40 auto identifier = GENERATE("x", "it", "long_identifier");
41 auto description = GENERATE("hello world", "error description");
42
43 {
44 auto value = GENERATE(
51 CHECK(result.identifier == identifier);
53 CHECK(result.description == description);
54 }
55 {
56 irsol::protocol::Inquiry inquiry{identifier};
Protocol error message representation.
std::variant< Assignment, Inquiry, Command > InMessage
Variant type representing any incoming message.
Definition variants.hpp:86
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
Definition types.hpp:150
Represents an assignment operation in the protocol.
Represents a command invocation in the protocol.
Definition command.hpp:33
static Error from(const T &msg, const std::string &description)
Creates an error from a specific incoming message type.
Definition error.hpp:63
Represents a value inquiry in the protocol.
Definition inquiry.hpp:32
auto value
irsol::protocol::InMessage inquiryInMessage(inquiry)
irsol::protocol::InMessage commandInMessage(command)
auto description
CHECK(result.identifier==identifier)
irsol::protocol::InMessage assignmentInMessage(assignment)
irsol::protocol::Assignment assignment
auto result
TEST_CASE("Pixel<T>::max())", "[PixelFormat]")