Unverified Commit c7fc0fab authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1012 from jcarpent/devel

Rework test
parents 1377b269 9cd8d2cc
Subproject commit 811bfc472940425a0a96cca7e01331f6cf68fced
Subproject commit 2de34adfce816937d2403cb602261ade0c26f0cd
//
// Copyright (c) 2016-2019 CNRS INRIA
// Copyright (c) 2016-2020 CNRS INRIA
//
#ifndef __pinocchio_check_hxx__
......@@ -121,8 +121,13 @@ namespace pinocchio
//CHECK_DATA( data.impulse_c.size()== model.nv );
CHECK_DATA( data.kinematic_hessians.dimension(0) == 6);
#if EIGEN_VERSION_AT_LEAST(3,2,90) && !EIGEN_VERSION_AT_LEAST(3,2,93)
CHECK_DATA( data.kinematic_hessians.dimension(1) == std::max(1,model.nv));
CHECK_DATA( data.kinematic_hessians.dimension(2) == std::max(1,model.nv));
#else
CHECK_DATA( data.kinematic_hessians.dimension(1) == model.nv);
CHECK_DATA( data.kinematic_hessians.dimension(2) == model.nv);
#endif
CHECK_DATA( (int)data.oMf.size() == model.nframes );
......
//
// Copyright (c) 2019 INRIA
// Copyright (c) 2019-2020 INRIA
//
#ifndef __pinocchio_math_tensor_hpp__
......@@ -245,12 +245,20 @@ namespace pinocchio
for(i = 0; i < NumIndices; i++)
m_dimensions[i] = dimensions[i];
m_storage.resize(size);
#ifdef EIGEN_INITIALIZE_COEFFS
bool size_changed = size != this->size();
if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
#endif
bool size_changed = size != this->size();
if(size_changed) m_storage.resize(size);
#ifdef EIGEN_INITIALIZE_COEFFS
if(size_changed)
{
#if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO)
m_storage.fill(Scalar(0));
#elif defined(EIGEN_INITIALIZE_MATRICES_BY_NAN)
m_storage.fill(std::numeric_limits<Scalar>::quiet_NaN());
#endif
}
#endif
}
EIGEN_DEVICE_FUNC bool operator==(const Tensor & other) const
......
......@@ -8,21 +8,21 @@
# --- MACROS ------------------------------------------------------------------
MACRO(ADD_TEST_CFLAGS target flag)
SET_PROPERTY(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}")
SET_PROPERTY(TARGET "test-${target}" APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}")
ENDMACRO(ADD_TEST_CFLAGS)
MACRO(ADD_PINOCCHIO_UNIT_TEST NAME)
SET(PKGS ${ARGN}) # Optional arguments
SET(TEST_NAME "${NAME}-test")
SET(TEST_NAME "test-${NAME}")
ADD_UNIT_TEST(${TEST_NAME} ${NAME}.cpp)
SET_TARGET_PROPERTIES(${TEST_NAME} PROPERTIES LINKER_LANGUAGE CXX)
TARGET_INCLUDE_DIRECTORIES(${TEST_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
ADD_TEST_CFLAGS(${TEST_NAME} "-DBOOST_TEST_DYN_LINK")
ADD_TEST_CFLAGS(${NAME} "-DBOOST_TEST_DYN_LINK")
SET(MODULE_NAME "${NAME}Test")
STRING(REGEX REPLACE "-" "_" MODULE_NAME ${MODULE_NAME})
ADD_TEST_CFLAGS(${TEST_NAME} "-DBOOST_TEST_MODULE=${MODULE_NAME}")
ADD_TEST_CFLAGS(${NAME} "-DBOOST_TEST_MODULE=${MODULE_NAME}")
PKG_CONFIG_USE_DEPENDENCY(${TEST_NAME} eigen3)
FOREACH(PKG ${PKGS})
......@@ -64,35 +64,35 @@ ADD_PINOCCHIO_UNIT_TEST(kinematics)
IF(URDFDOM_FOUND)
ADD_PINOCCHIO_UNIT_TEST(urdf urdfdom)
ADD_TEST_CFLAGS(urdf-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(urdf '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_PINOCCHIO_UNIT_TEST(value urdfdom)
ADD_TEST_CFLAGS(value-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(value '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
IF(HPP_FCL_FOUND)
ADD_PINOCCHIO_UNIT_TEST(geom urdfdom)
ADD_TEST_CFLAGS(geom-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(geom '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_PINOCCHIO_UNIT_TEST(srdf urdfdom)
ADD_TEST_CFLAGS(srdf-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(srdf '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ENDIF(HPP_FCL_FOUND)
ENDIF(URDFDOM_FOUND)
IF(LUA5_FOUND)
ADD_PINOCCHIO_UNIT_TEST(lua ${LUA5_PACKAGE})
ADD_TEST_CFLAGS(lua-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(lua '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ENDIF(LUA5_FOUND)
IF(BUILD_PYTHON_INTERFACE)
ADD_PINOCCHIO_UNIT_TEST(python_parser eigenpy)
ADD_TEST_CFLAGS(python_parser-test '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
ADD_TEST_CFLAGS(python_parser '-DPINOCCHIO_MODEL_DIR=\\\"${PINOCCHIO_MODEL_DIR}\\\"')
TARGET_LINK_LIBRARIES(python_parser-test ${PYWRAP})
TARGET_LINK_LIBRARIES(python_parser-test ${PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(test-python_parser ${PYWRAP})
TARGET_LINK_LIBRARIES(test-python_parser ${PYTHON_LIBRARIES})
SET(ENV_VARIABLES "PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python:$ENV{PYTHONPATH}")
IF(APPLE)
LIST(APPEND ENV_VARIABLES "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}")
LIST(APPEND ENV_VARIABLES "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}")
ENDIF(APPLE)
SET_PROPERTY(TEST python_parser-test PROPERTY ENVIRONMENT ${ENV_VARIABLES})
SET_PROPERTY(TEST test-python_parser PROPERTY ENVIRONMENT ${ENV_VARIABLES})
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
......@@ -118,7 +118,7 @@ ADD_PINOCCHIO_UNIT_TEST(version)
ADD_PINOCCHIO_UNIT_TEST(copy)
MAKE_DIRECTORY("${CMAKE_CURRENT_BINARY_DIR}/serialization-data")
ADD_PINOCCHIO_UNIT_TEST(serialization)
ADD_TEST_CFLAGS(serialization-test '-DTEST_SERIALIZATION_FOLDER=\\\"${CMAKE_CURRENT_BINARY_DIR}/serialization-data\\\"')
ADD_TEST_CFLAGS(serialization '-DTEST_SERIALIZATION_FOLDER=\\\"${CMAKE_CURRENT_BINARY_DIR}/serialization-data\\\"')
# Derivatives algo
ADD_PINOCCHIO_UNIT_TEST(kinematics-derivatives)
......@@ -138,25 +138,25 @@ IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(cppadcg-basic cppadcg)
SET_PROPERTY(TARGET cppadcg-basic-test PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(cppadcg-basic-test ${CMAKE_DL_LIBS})
SET_PROPERTY(TARGET cppadcg-basic PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(cppadcg-basic ${CMAKE_DL_LIBS})
ADD_PINOCCHIO_UNIT_TEST(cppadcg-algo cppadcg)
SET_PROPERTY(TARGET cppadcg-algo-test PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(cppadcg-algo-test ${CMAKE_DL_LIBS})
SET_PROPERTY(TARGET cppadcg-algo PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(cppadcg-algo ${CMAKE_DL_LIBS})
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(casadi-basic casadi)
SET_PROPERTY(TARGET casadi-basic-test PROPERTY CXX_STANDARD 11)
SET_PROPERTY(TARGET casadi-basic PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-spatial casadi)
SET_PROPERTY(TARGET casadi-spatial-test PROPERTY CXX_STANDARD 11)
SET_PROPERTY(TARGET casadi-spatial PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-joints casadi)
SET_PROPERTY(TARGET casadi-joints-test PROPERTY CXX_STANDARD 11)
SET_PROPERTY(TARGET casadi-joints PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-algo casadi)
SET_PROPERTY(TARGET casadi-algo-test PROPERTY CXX_STANDARD 11)
SET_PROPERTY(TARGET casadi-algo PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-algo-derivatives casadi)
SET_PROPERTY(TARGET casadi-algo-derivatives-test PROPERTY CXX_STANDARD 11)
SET_PROPERTY(TARGET casadi-algo-derivatives PROPERTY CXX_STANDARD 11)
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
//
// Copyright (c) 2019 INRIA
// Copyright (c) 2019-2020 INRIA
//
#include "pinocchio/multibody/data.hpp"
#include "pinocchio/multibody/model.hpp"
#include "pinocchio/parsers/sample-models.hpp"
#include "pinocchio/algorithm/check.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/utility/binary.hpp>
......@@ -17,6 +19,8 @@ BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
{
Model empty_model;
Data empty_data(empty_model);
BOOST_CHECK(empty_model.check(empty_data));
}
BOOST_AUTO_TEST_CASE(test_data_start_idx_v_fromRow)
......
......@@ -35,7 +35,7 @@ IF(URDFDOM_FOUND)
ENDIF(URDFDOM_FOUND)
FOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
ADD_PYTHON_UNIT_TEST("py-${TEST}" "unittest/python/${TEST}.py" "bindings/python")
ADD_PYTHON_UNIT_TEST("test-python-${TEST}" "unittest/python/${TEST}.py" "bindings/python")
ENDFOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
MAKE_DIRECTORY("${CMAKE_CURRENT_BINARY_DIR}/serialization-data")
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