Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arntanguy committed Mar 15, 2024
1 parent 7aaaa37 commit 70af747
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 "$<TARGET_FILE_DIR:mc_panda_lirmm>")
24 changes: 24 additions & 0 deletions tests/test_module.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <mc_rbdyn/RobotLoader.h>
#include <mc_panda_lirmm/panda_lirmm.h>

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);
}

0 comments on commit 70af747

Please sign in to comment.