25TEST(ServiceParserMultipleFT, check_settings_positive_001)
27 yarp::os::Bottle bottle;
28 bottle.fromString(
"(SETTINGS (ftPeriod 10) (enabledSensors fakeId) (temperaturePeriod 100) (useCalibration true) )");
34 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
38 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
39 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
42TEST(ServiceParserMultipleFT, check_settings_positive_002)
44 yarp::os::Bottle bottle;
45 bottle.fromString(
"(SETTINGS (ftPeriod 10 20) (enabledSensors fakeId fakeId1) (temperaturePeriod 100 200) (useCalibration true false) )");
51 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}},
52 {
"fakeId1", {20, 200, eoas_ft_mode_raw, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
56 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
57 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
58 EXPECT_EQ(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
113TEST(ServiceParserMultipleFT, check_property_sensors_positive_001)
116 yarp::os::Bottle bottle;
117 bottle.fromString(
"(SENSORS (id fakeId) (board strain2) (location CAN2:13) (framename fakeFrameName) )");
118 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0,
"fakeFrameName"}}};
122 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0,
"fakeFrameName"}}};
126 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
127 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
130TEST(ServiceParserMultipleFT, check_property_sensors_positive_002)
133 yarp::os::Bottle bottle;
134 bottle.fromString(
"(SENSORS (id fakeId fakeId1) (board strain2 strain2) (location CAN2:13 CAN2:14) (framename fakeFrameName1 fakeFrameName2) )");
135 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0,
"fakeFrameName1"}},
136 {
"fakeId1", {20, 200, eoas_ft_mode_raw, eobrd_unknown, 2, 14, 0, 0, 0, 0, 0,
"fakeFrameName2"}}};
140 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0,
"fakeFrameName1"}},
141 {
"fakeId1", {20, 200, eoas_ft_mode_raw, eobrd_strain2, 2, 14, 0, 0, 0, 0, 0,
"fakeFrameName2"}}};
145 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
146 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
147 EXPECT_EQ(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
150TEST(ServiceParserMultipleFT, check_property_sensors_positive_003)
153 yarp::os::Bottle bottle;
154 bottle.fromString(
"(SENSORS (id fakeId fakeId1) (board strain2 strain2) (location CAN2:13 CAN2:14) )");
155 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
159 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}};
163 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
164 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
167TEST(ServiceParserMultipleFT, check_property_sensors_positive_004)
170 yarp::os::Bottle bottle;
171 bottle.fromString(
"(SENSORS (id fakeId) (board eobrd_strain2) (location CAN2:13) )");
172 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
176 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}};
180 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
181 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
184TEST(ServiceParserMultipleFT, check_property_sensors_positive_005)
187 yarp::os::Bottle bottle;
188 bottle.fromString(
"(SENSORS (id fakeId) (board eobrd_strain) (location CAN2:13) )");
189 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
193 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 0, 0, 0, 0, 0}}};
197 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
198 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
201TEST(ServiceParserMultipleFT, check_property_sensors_negative_001)
204 yarp::os::Bottle bottle;
205 bottle.fromString(
"(SENSORS (id fakeId) (board strain2) (location CAN2:14) )");
206 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
210 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}};
214 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
215 EXPECT_NE(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
218TEST(ServiceParserMultipleFT, check_property_sensors_negative_002)
221 yarp::os::Bottle bottle;
222 bottle.fromString(
"(SENSORS (id fakeId) (board strain2) (location CANx:15) )");
223 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 0, 0, 0, 0, 0, 0, 0}}};
230TEST(ServiceParserMultipleFT, check_property_sensors_negative_003)
233 yarp::os::Bottle bottle;
234 bottle.fromString(
"(SENSORS (id fakeId fakeId1) (board strain2 strain2) (location CAN2:13 CAN2:14) )");
235 serviceParser.
ftInfo_ = {{
"notexistent", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {20, 200, eoas_ft_mode_raw, eobrd_unknown, 2, 14, 0, 0, 0, 0, 0}}};
242TEST(ServiceParserMultipleFT, check_property_sensors_negative_004)
245 yarp::os::Bottle bottle;
246 bottle.fromString(
"(SENSORS (id fakeId fakeId1) (board wrongBoard strain2) (location CAN2:13 CAN2:14) )");
247 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {20, 200, eoas_ft_mode_raw, eobrd_unknown, 2, 14, 0, 0, 0, 0, 0}}};
254TEST(ServiceParserMultipleFT, check_property_canboards_positive_001)
257 yarp::os::Bottle bottle;
258 bottle.fromString(
"(CANBOARDS (type strain2) (PROTOCOL (major 2) (minor 3) ) (FIRMWARE (major 4) (minor 5) (build 6) ) )");
259 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}};
263 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}}};
267 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
268 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
271TEST(ServiceParserMultipleFT, check_property_canboards_positive_002)
274 yarp::os::Bottle bottle;
275 bottle.fromString(
"(CANBOARDS (type strain2) (PROTOCOL (major 2) (minor 3) ) (FIRMWARE (major 4) (minor 5) (build 6) ) )");
276 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 0, 0, 0, 0, 0}}};
280 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}},
281 {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 0, 0, 0, 0, 0}}};
285 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
286 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
287 EXPECT_EQ(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
290TEST(ServiceParserMultipleFT, check_property_canboards_positive_003)
293 yarp::os::Bottle bottle;
294 bottle.fromString(
"(CANBOARDS (type strain2 strain) (PROTOCOL (major 2 7) (minor 3 8) ) (FIRMWARE (major 4 9) (minor 5 10) (build 6 11) ) )");
295 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 0, 0, 0, 0, 0}}};
299 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}},
300 {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 7, 8, 9, 10, 11}}};
304 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
305 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
306 EXPECT_EQ(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
309TEST(ServiceParserMultipleFT, check_property_canboards_positive_004)
312 yarp::os::Bottle bottle;
313 bottle.fromString(
"(CANBOARDS (type eobrd_strain2) (PROTOCOL (major 2) (minor 3) ) (FIRMWARE (major 4) (minor 5) (build 6) ) )");
314 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}};
318 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}}};
322 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
323 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
326TEST(ServiceParserMultipleFT, check_property_canboards_negative_001)
329 yarp::os::Bottle bottle;
330 bottle.fromString(
"(CANBOARDS (type strain2 strain) (PROTOCOL (major 2 7) (minor 3 8) ) (FIRMWARE (major 4 9) (minor 5 10) (build 6 11) ) )");
331 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0}}};
335 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}},
336 {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 7, 8, 9, 10, 11}}};
340 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
341 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
342 EXPECT_NE(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
345TEST(ServiceParserMultipleFT, check_property_canboards_negative_002)
348 yarp::os::Bottle bottle;
349 bottle.fromString(
"(CANBOARDS (type strain2 strain) (PROTOCOL (major 2 7) (minor 3 8) ) (FIRMWARE (major 4 9) (minor 5 10) (build 6 20) ) )");
350 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0}}};
354 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}},
355 {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 7, 8, 9, 10, 11}}};
359 ASSERT_EQ(expected.size(), serviceParser.
ftInfo_.size());
360 EXPECT_EQ(expected.at(
"fakeId"), serviceParser.
ftInfo_.at(
"fakeId"));
361 EXPECT_NE(expected.at(
"fakeId1"), serviceParser.
ftInfo_.at(
"fakeId1"));
364TEST(ServiceParserMultipleFT, check_property_canboards_negative_003)
367 yarp::os::Bottle bottle;
368 bottle.fromString(
"(CANBOARDS (type wrongboardname strain) (PROTOCOL (major 2 7) (minor 3 8) ) (FIRMWARE (major 4 9) (minor 5 10) (build 6 20) ) )");
369 serviceParser.
ftInfo_ = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 0, 0, 0, 0, 0}}, {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_unknown, 2, 13, 0, 0, 0, 0, 0}}};
373 std::map<std::string ,
FtInfo> expected = {{
"fakeId", {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 2, 3, 4, 5, 6}},
374 {
"fakeId1", {10, 100, eoas_ft_mode_calibrated, eobrd_strain, 2, 13, 7, 8, 9, 10, 11}}};
430TEST(ServiceParserMultipleFT, toEomn_positive_001)
432 FtInfo info = {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 1, 13, 4, 5, 1, 2, 3};
434 eOas_ft_sensordescriptor_t
out;
435 bool res = info.toEomn(
out);
437 eOas_ft_sensordescriptor_t expected = {{eobrd_strain2, {1, 2, 3}, {4, 5}}, {0, 13, eobrd_caninsideindex_none}, 0};
440 EXPECT_EQ(expected,
out);
443TEST(ServiceParserMultipleFT, toEomn_positive_002)
445 FtInfo info = {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 2, 13, 4, 5, 1, 2, 3};
447 eOas_ft_sensordescriptor_t
out;
448 bool res = info.toEomn(
out);
450 eOas_ft_sensordescriptor_t expected = {{eobrd_strain2, {1, 2, 3}, {4, 5}}, {1, 13, eobrd_caninsideindex_none}, 0};
453 EXPECT_EQ(expected,
out);
456TEST(ServiceParserMultipleFT, toEomn_negative_001)
458 FtInfo info = {10, 100, eoas_ft_mode_calibrated, eobrd_strain2, 3, 13, 4, 5, 1, 2, 3};
460 eOas_ft_sensordescriptor_t
out;
461 bool res = info.toEomn(
out);