lp+mgmt+security: tidy up TLV parsing code in a few classes
Change-Id: I458bd10e16a05b08ed444f983a18453648cd191b
diff --git a/tests/unit/mgmt/control-response.t.cpp b/tests/unit/mgmt/control-response.t.cpp
index 6bda463..3d0f4b6 100644
--- a/tests/unit/mgmt/control-response.t.cpp
+++ b/tests/unit/mgmt/control-response.t.cpp
@@ -74,19 +74,24 @@
return e.what() == "Expecting ControlResponse element, but TLV has type 100"sv;
});
- // empty TLV
+ // missing StatusCode
BOOST_CHECK_EXCEPTION(cr.wireDecode("6500"_block), tlv::Error, [] (const auto& e) {
- return e.what() == "missing StatusCode sub-element"sv;
+ return e.what() == "StatusCode is missing or out of order"sv;
});
- // missing StatusCode
- BOOST_CHECK_EXCEPTION(cr.wireDecode("65026700"_block), tlv::Error, [] (const auto& e) {
- return e.what() == "missing StatusCode sub-element"sv;
+ // out-of-order StatusCode
+ BOOST_CHECK_EXCEPTION(cr.wireDecode("650567006601C8"_block), tlv::Error, [] (const auto& e) {
+ return e.what() == "StatusCode is missing or out of order"sv;
});
// missing StatusText
BOOST_CHECK_EXCEPTION(cr.wireDecode("650466020194"_block), tlv::Error, [] (const auto& e) {
- return e.what() == "missing StatusText sub-element"sv;
+ return e.what() == "StatusText is missing or out of order"sv;
+ });
+
+ // out-of-order StatusText
+ BOOST_CHECK_EXCEPTION(cr.wireDecode("65086602019469006700"_block), tlv::Error, [] (const auto& e) {
+ return e.what() == "StatusText is missing or out of order"sv;
});
}