Go to the source code of this file.
|
| TEST_CASE ("Parsing invalid identifier", "[Protocol][Protocol::Parser]") |
|
| TEST_CASE ("Assignment parsing int", "[Protocol][Protocol::Parser]") |
|
| TEST_CASE ("Assignment parsing double", "[Protocol][Protocol::Parser]") |
|
| TEST_CASE ("Assignment parsing string", "[Protocol][Protocol::Parser]") |
|
| REQUIRE (msg.has_value()) |
|
| CHECK (asg.identifier==identifier) |
|
| CHECK (std::get< std::string >(asg.value)==value) |
|
| TEST_CASE ("Inquiry parsing", "[Protocol][Protocol::Parser]") |
|
| TEST_CASE ("Command parsing", "[Protocol][Protocol::Parser]") |
|
◆ CHECK() [1/2]
CHECK |
( |
asg. |
identifier = =identifier | ) |
|
◆ CHECK() [2/2]
CHECK |
( |
std::get< std::string > |
asg.value = =value | ) |
|
◆ REQUIRE()
REQUIRE |
( |
msg. |
has_value() | ) |
|
◆ TEST_CASE() [1/6]
TEST_CASE |
( |
"Assignment parsing double" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 42 of file test_parser.cpp.
43{
44 auto identifier = GENERATE(
45 "x", "it", "long_identifier", "sequence_identifier[4]", "nested_sequence_identifier[4][423]");
46 auto value = GENERATE(42.0, 0, 5, 32121.4234234);
47
48 std::string
input = std::string(identifier) +
"=" + std::to_string(
value);
49
52
53 auto asg = std::get<irsol::protocol::Assignment>(*
msg);
54
57}
static std::optional< InMessage > parse(const std::string &line)
Attempts to parse a single protocol input line into a structured InMessage.
CHECK(asg.identifier==identifier)
◆ TEST_CASE() [2/6]
TEST_CASE |
( |
"Assignment parsing int" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 25 of file test_parser.cpp.
26{
27 auto identifier = GENERATE(
28 "x", "it", "long_identifier", "sequence_identifier[4]", "nested_sequence_identifier[4][423]");
29 auto value = GENERATE(42, 5, 32121);
30
31 std::string
input = std::string(identifier) +
"=" + std::to_string(
value);
32
35
36 auto asg = std::get<irsol::protocol::Assignment>(*
msg);
37
40}
◆ TEST_CASE() [3/6]
TEST_CASE |
( |
"Assignment parsing string" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 59 of file test_parser.cpp.
60{
61 auto identifier = GENERATE(
62 "x", "it", "long_identifier", "sequence_identifier[4]", "nested_sequence_identifier[4][423]");
63 auto value = GENERATE(
"c",
"longer",
"long_string_with_underscores",
"5è4?-é");
64
65 std::string
input = std::string(identifier) +
"=" +
value;
66
69
70 auto asg = std::get<irsol::protocol::Assignment>(*
msg);
71
74}
◆ TEST_CASE() [4/6]
TEST_CASE |
( |
"Command parsing" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 106 of file test_parser.cpp.
107{
108 auto identifier = GENERATE("x", "it", "long_identifier");
109
110 std::string
input = std::string(identifier);
113 auto inq = std::get<irsol::protocol::Command>(*
msg);
114 CHECK(inq.identifier == identifier);
115}
◆ TEST_CASE() [5/6]
TEST_CASE |
( |
"Inquiry parsing" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 94 of file test_parser.cpp.
95{
96 auto identifier = GENERATE(
97 "x", "it", "long_identifier", "sequence_identifier[4]", "nested_sequence_identifier[4][423]");
98
99 std::string
input = std::string(identifier) +
"?";
102 auto inq = std::get<irsol::protocol::Inquiry>(*
msg);
103 CHECK(inq.identifier == identifier);
104}
◆ TEST_CASE() [6/6]
TEST_CASE |
( |
"Parsing invalid identifier" |
, |
|
|
"" |
[Protocol][Protocol::Parser] |
|
) |
| |
Definition at line 6 of file test_parser.cpp.
7{
8
9 auto identifier = GENERATE(
10 ""
11 "identifier with spaces",
12 "identifier-with-dashes",
13 "non-alphanumeric<",
14 "??");
15
16
17 auto suffix = GENERATE("=value", "=42", "=3.14", "?", "");
18
19 std::string line = std::string(identifier) + suffix;
20
23}
◆ asg
◆ input
◆ msg
◆ prefixSuffixChars
auto prefixSuffixChars = GENERATE("\"\"", "''", "{}", " ") |
◆ value
auto value = GENERATE("c", "longer", "long_string_with_underscores", "5è4?-é") |