Basic support for string parameters

This commit is contained in:
Pavel Kirienko
2015-03-19 00:19:40 +03:00
parent ddc4b649a8
commit 3b7669219e
4 changed files with 20 additions and 4 deletions
+9 -1
View File
@@ -43,6 +43,10 @@ struct ParamServerTestManager : public uavcan::IParamManager
{
it->second = double(value.value_float[0]);
}
else if (!value.value_string.empty())
{
it->second = std::atof(value.value_string[0].value.c_str());
}
else
{
assert(0);
@@ -151,7 +155,11 @@ TEST(ParamServer, Basic)
// Set by index
get_set_rq = uavcan::protocol::param::GetSet::Request();
get_set_rq.index = 0;
get_set_rq.value.value_int.push_back(424242);
{
uavcan::protocol::param::ValueString str;
str.value = "424242";
get_set_rq.value.value_string.push_back(str);
}
doCall(get_set_cln, get_set_rq, nodes);
ASSERT_STREQ("foobar", get_set_cln.collector.result->response.name.c_str());
ASSERT_FLOAT_EQ(424242, get_set_cln.collector.result->response.value.value_float[0]);