Skip to content
Snippets Groups Projects
Verified Commit 8c6586bc authored by Justin Carpentier's avatar Justin Carpentier
Browse files

unittest/serialization: test joint serialization

parent c3e999ee
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
#include "pinocchio/serialization/frame.hpp"
#include "pinocchio/serialization/joints.hpp"
#include <iostream>
#include <boost/test/unit_test.hpp>
......@@ -86,6 +87,56 @@ BOOST_AUTO_TEST_CASE(test_multibody_serialization)
generic_test(frame,TEST_SERIALIZATION_FOLDER"/Frame","Frame");
}
struct TestJoint
{
template <typename T>
void operator()(const T) const
{
T jmodel;
jmodel.setIndexes(0,0,0);
test(jmodel);
}
void operator()(const pinocchio::JointModelComposite & ) const
{
pinocchio::JointModelComposite jmodel((pinocchio::JointModelRX()));
jmodel.addJoint(pinocchio::JointModelRY());
jmodel.setIndexes(0,0,0);
test(jmodel);
}
void operator()(const pinocchio::JointModelRevoluteUnaligned & ) const
{
pinocchio::JointModelRevoluteUnaligned jmodel(1.5, 1., 0.);
jmodel.setIndexes(0,0,0);
test(jmodel);
}
void operator()(const pinocchio::JointModelPrismaticUnaligned & ) const
{
pinocchio::JointModelPrismaticUnaligned jmodel(1.5, 1., 0.);
jmodel.setIndexes(0,0,0);
test(jmodel);
}
template<typename JointType>
static void test(JointType & jmodel)
{
generic_test(jmodel,TEST_SERIALIZATION_FOLDER"/Joint",jmodel.shortname());
}
};
BOOST_AUTO_TEST_CASE(test_multibody_joints_serialization)
{
using namespace pinocchio;
boost::mpl::for_each<JointModelVariant::types>(TestJoint());
}
BOOST_AUTO_TEST_CASE(test_model_serialization)
{
using namespace pinocchio;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment