diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..b2eca82 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(test_module test_module.cpp) +target_link_libraries(test_module PUBLIC mc_rtc::mc_rbdyn mc_panda_lirmm::panda_lirmm) +add_test(NAME test_module COMMAND test_module "$") diff --git a/tests/test_module.cpp b/tests/test_module.cpp new file mode 100644 index 0000000..19014c0 --- /dev/null +++ b/tests/test_module.cpp @@ -0,0 +1,24 @@ +#include +#include + +int main(int argc, char * argv[]) +{ + if(argc < 2) + { + mc_rtc::log::critical("Usage: {} [MODULE_DIR]", argv[0]); + return 1; + } + mc_rbdyn::RobotLoader::clear(); + mc_rbdyn::RobotLoader::update_robot_module_path({argv[1]}); + bool res = true; + auto check_module = + [&res](mc_panda_lirmm::PandaLIRMMRobots robot, bool pump, bool foot, bool hand, bool fixSensorFrame) + { + auto moduleName = NameFromParams(robot, pump, foot, hand, fixSensorFrame); + auto rm = mc_rbdyn::RobotLoader::get_robot_module(moduleName); + mc_rtc::log::info("{} provides robot {} which has {} dof", moduleName, rm->name, rm->mb.nrDof()); + res = rm ? 0 : 1; + }; + + mc_panda_lirmm::ForAllVariants(check_module); +}