Commit ac1bd01d authored by Pierre Fernbach's avatar Pierre Fernbach Committed by Pierre Fernbach
Browse files

[Tests] WIP : add (failing) unit test for serialization of SO3Linear

parent 7bc446a3
......@@ -1680,6 +1680,30 @@ void so3LinearTest(bool& error) {
}
}
void SO3serializationTest(bool &error){
std::string fileName("fileTest");
std::string errmsg("SO3serializationTest : curve serialized is not equivalent to the original curve.");
quaternion_t q0( 0.544,-0.002, -0.796, 0.265);
quaternion_t q1(0.7071, 0.7071, 0, 0);
SO3Linear_t so3Traj(q0, q1,0.5, 2.2);
so3Traj.saveAsText<SO3Linear_t>(fileName+".txt");
SO3Linear_t so3_from_txt;
so3_from_txt.loadFromText<SO3Linear_t>(fileName+".txt");
CompareCurves<SO3Linear_t, SO3Linear_t>(so3Traj, so3_from_txt, errmsg+" For text serialization", error,1e-3); // approximations comes from the conversions quaternion->matrix->quaternion
so3Traj.saveAsXML<SO3Linear_t>(fileName+".xml","so3Curve");
SO3Linear_t so3_from_xml;
so3_from_xml.loadFromXML<SO3Linear_t>(fileName+".xml","so3Curve");
CompareCurves<SO3Linear_t, SO3Linear_t>(so3Traj, so3_from_xml,errmsg+" For XML serialization", error,1e-3);
so3Traj.saveAsBinary<SO3Linear_t>(fileName);
SO3Linear_t so3_from_binary;
so3_from_binary.loadFromBinary<SO3Linear_t>(fileName);
CompareCurves<SO3Linear_t, SO3Linear_t>(so3Traj, so3_from_binary, errmsg+" For binary serialization", error,1e-3);
}
void se3CurveTest(bool& error) {
quaternion_t q0(1, 0, 0, 0);
quaternion_t q1(0., 1., 0, 0);
......@@ -2230,6 +2254,7 @@ int main(int /*argc*/, char** /*argv[]*/) {
serializationCurvesTest(error);
polynomialFromBoundaryConditions(error);
so3LinearTest(error);
SO3serializationTest(error);
se3CurveTest(error);
BezierLinearProblemsetup_control_pointsNoConstraint(error);
BezierLinearProblemsetup_control_pointsVarCombinatorialInit(error);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment