20 std::match_results<std::string_view::const_iterator>
match;
21 REQUIRE(ControlServiceHelpers::parseControl(
"foo",
match) ==
false);
22 std::match_results<std::string_view::const_iterator> match2;
23 std::string sv =
"CONTROL_ACTION: READY_TO_QUIT_ME";
24 REQUIRE(ControlServiceHelpers::parseControl(sv, match2) ==
true);
25 REQUIRE(match2[1].
str() ==
"QUIT");
26 REQUIRE(match2[2].
str() ==
"ME");
27 std::string sv2 =
" dsca CONTROL_ACTION: READY_TO_QUIT_ME";
28 REQUIRE(ControlServiceHelpers::parseControl(sv2, match2) ==
true);
29 REQUIRE(match2[1].
str() ==
"QUIT");
30 REQUIRE(match2[2].
str() ==
"ME");
31 const static std::regex controlRE2(
"^(NOTIFY_STREAMING_STATE) (IDLE|STREAMING|EOS)", std::regex::optimize);
32 const static std::regex controlRE3(
"^(NOTIFY_DEVICE_STATE) ([A-Z ]*)", std::regex::optimize);
33 std::string sv3 =
" dsca CONTROL_ACTION: NOTIFY_STREAMING_STATE IDLE";
34 REQUIRE(ControlServiceHelpers::parseControl(sv3, match2) ==
true);
35 REQUIRE(match2[1].
str() ==
"NOTIFY_STREAMING_STATE");
36 REQUIRE(match2[2].
str() ==
"IDLE");
37 std::string_view sv4 =
" dsca CONTROL_ACTION: NOTIFY_STREAMING_STATE IDLE";
38 REQUIRE(ControlServiceHelpers::parseControl(sv4, match2) ==
true);
39 REQUIRE(match2[1].
str() ==
"NOTIFY_STREAMING_STATE");
40 REQUIRE(match2[2].
str() ==
"IDLE");
41 std::string_view sv5 =
" asdsca CONTROL_ACTION: NOTIFY_DEVICE_STATE STOP";
42 REQUIRE(ControlServiceHelpers::parseControl(sv5, match2) ==
true);
43 REQUIRE(match2[1].
str() ==
"NOTIFY_DEVICE_STATE");
44 REQUIRE(match2[2].
str() ==
"STOP");
45 std::string_view sv6 =
" asdsca CONTROL_ACTION: ";
46 REQUIRE(ControlServiceHelpers::parseControl(sv6, match2) ==
false);