mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 04:50:34 +08:00
Max data type name length test
This commit is contained in:
@@ -112,7 +112,7 @@ std::string DataTypeDescriptor::toString() const
|
||||
}
|
||||
|
||||
using namespace std; // For snprintf()
|
||||
char buf[80];
|
||||
char buf[128];
|
||||
(void)snprintf(buf, sizeof(buf), "%s:%u%c:%016llx",
|
||||
full_name_, static_cast<unsigned>(id_.get()), kindch,
|
||||
static_cast<unsigned long long>(signature_.get()));
|
||||
|
||||
@@ -105,6 +105,12 @@ TEST(DataTypeDescriptor, ToString)
|
||||
desc = uavcan::DataTypeDescriptor(uavcan::DataTypeKindMessage, 123,
|
||||
uavcan::DataTypeSignature(0xdeadbeef1234), "Bar");
|
||||
ASSERT_EQ("Bar:123m:0000deadbeef1234", desc.toString());
|
||||
|
||||
// Max length - 80 chars
|
||||
desc = uavcan::DataTypeDescriptor(uavcan::DataTypeKindMessage, 1023, uavcan::DataTypeSignature(0xdeadbeef12345678),
|
||||
"sirius_cybernetics_corporation.marvin.model_a.LongDataTypeName123456789abcdefghi");
|
||||
ASSERT_EQ("sirius_cybernetics_corporation.marvin.model_a.LongDataTypeName123456789abcdefghi:1023m:deadbeef12345678",
|
||||
desc.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user