Skip to content

Commit 05d4121

Browse files
Merge pull request #49 from ArthurVal/add/linear_feedback_controller_unittests
Add the 'LinearFeedbackController' unit-tests
2 parents b5d24a9 + 82873e9 commit 05d4121

File tree

8 files changed

+646
-87
lines changed

8 files changed

+646
-87
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ if(BUILD_TESTING)
9292

9393
ament_auto_add_gtest(test_lf_controller tests/test_lf_controller.cpp)
9494
target_link_libraries(test_lf_controller ${PROJECT_NAME})
95+
96+
ament_auto_add_gtest(test_linear_feedback_controller
97+
tests/test_linear_feedback_controller.cpp)
98+
target_link_libraries(test_linear_feedback_controller ${PROJECT_NAME})
9599
endif()
96100

97101
#

tests/test_lf_controller.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <sstream>
12
#include <string_view>
23
#include <tuple>
34

@@ -234,23 +235,10 @@ INSTANTIATE_TEST_SUITE_P(
234235
{.name = "l12"},
235236
},
236237
})),
237-
[](auto&& info) {
238-
std::string str;
239-
if (info.param.has_free_flyer) {
240-
str.append("FreeFlyer_");
241-
}
242-
243-
str.append(std::to_string(size(info.param.joint_list)));
244-
str.append("_Joints");
245-
246-
for (const auto& [name, type] : info.param.joint_list) {
247-
str.append("_");
248-
str.append(name);
249-
str.append("_");
250-
str.append(ToString(type));
251-
}
252-
253-
return str;
238+
[](const auto& info) {
239+
std::stringstream stream;
240+
PrintTo(info.param, &stream, {.as_param_name = true});
241+
return stream.str();
254242
});
255243

256244
} // namespace

0 commit comments

Comments
 (0)