Commit 074e3ab1 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Tests] add (failing) test to deserialize file from previous version

parent 8a8a4eca
......@@ -7,6 +7,7 @@ SET(${PROJECT_NAME}_TESTS
geometry
scenario
examples
serialization_versionning
)
FOREACH(TEST ${${PROJECT_NAME}_TESTS})
......@@ -15,6 +16,7 @@ FOREACH(TEST ${${PROJECT_NAME}_TESTS})
ENDFOREACH(TEST ${${PROJECT_NAME}_TESTS})
TARGET_COMPILE_DEFINITIONS(examples PRIVATE -DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../examples/")
TARGET_COMPILE_DEFINITIONS(serialization_versionning PRIVATE -DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../examples/")
IF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(python)
......
// Copyright (c) 2015-2018, CNRS
// Authors: Justin Carpentier <jcarpent@laas.fr>
// Copyright (c) 2019-2020, CNRS
// Authors: Pierre Fernbach <pierre.fernbach@laas.fr>,
#include <iostream>
......
// Copyright (c) 2019-2020, CNRS
// Authors: Pierre Fernbach <pierre.fernbach@laas.fr>,
#include <iostream>
#define BOOST_TEST_MODULE StatsTests
#include <boost/test/unit_test.hpp>
#include <boost/utility/binary.hpp>
#include "multicontact-api/scenario/contact-sequence.hpp"
#include "multicontact-api/scenario/fwd.hpp"
#include "curves/fwd.h"
#include <curves/so3_linear.h>
#include <curves/se3_curve.h>
#include <curves/polynomial.h>
#include <curves/bezier_curve.h>
#include <curves/piecewise_curve.h>
#include <curves/exact_cubic.h>
#include <curves/cubic_hermite_spline.h>
/**
* This unit test try to deserialize the ContactSequences in the examples/previous_versions folder
* And check that they are compatible with the current version
*/
using namespace multicontact_api::scenario;
const std::string path = TEST_DATA_PATH;
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
BOOST_AUTO_TEST_CASE(api_0) {
ContactSequence cs;
cs.loadFromBinary(path + "previous_versions/api_0.cs");
BOOST_CHECK_EQUAL(cs.size(), 9);
BOOST_CHECK(cs.haveConsistentContacts());
BOOST_CHECK(cs.haveTimings());
BOOST_CHECK(cs.haveCentroidalValues());
BOOST_CHECK(cs.haveCentroidalTrajectories());
BOOST_CHECK(cs.haveEffectorsTrajectories(1e-1));
BOOST_CHECK(cs.haveJointsTrajectories());
BOOST_CHECK(cs.haveJointsDerivativesTrajectories());
BOOST_CHECK(cs.haveContactForcesTrajectories());
BOOST_CHECK(cs.haveZMPtrajectories());
BOOST_CHECK(cs.haveFriction());
BOOST_CHECK(!cs.haveContactModelDefined());
}
BOOST_AUTO_TEST_SUITE_END()
Markdown is supported
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