Skip to content
Snippets Groups Projects
Commit bd390fee authored by Francois Bleibel's avatar Francois Bleibel
Browse files

Added SignalCaster tests with shared libraries.

parent 99d04857
No related branches found
No related tags found
No related merge requests found
......@@ -3,27 +3,49 @@
#
### tests
SET(tests
SET(tests_exe
test_pool
test_depend
test_signalcast)
FOREACH(test_name ${tests})
SET(EXECUTABLE_NAME ${test_name})
SET(tests_libs
test_signalcast_libA
test_signalcast_libB
)
ADD_DEFINITIONS(-DDEBUG=2)
SET(test_signalcast_additional_libs ${test_libs})
ADD_EXECUTABLE(${EXECUTABLE_NAME}
${test_name}.cpp)
ADD_DEFINITIONS(-DDEBUG=2)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../include
)
LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/lib)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../include
)
# Additional tests
FOREACH(test_name ${tests_libs})
SET(LIBRARY_NAME ${test_name})
LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/lib)
ADD_LIBRARY(${LIBRARY_NAME}
SHARED
${test_name}.cpp)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
${PROJECT_NAME})
ENDFOREACH(test_name)
FOREACH(test_name ${tests_exe})
SET(EXECUTABLE_NAME ${test_name})
ADD_EXECUTABLE(${EXECUTABLE_NAME}
${test_name}.cpp)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
${${test_name}_additional_libs})
ADD_TEST(NAME ${test_name} COMMAND ${test_name})
ENDFOREACH(test_name)
\ No newline at end of file
......@@ -35,6 +35,10 @@
// only included because we will define new casts here. Not needed in general.
#include <dynamic-graph/signal-caster.h>
#include "test_signalcast_libA.h"
#include "test_signalcast_libB.h"
using namespace std;
using namespace dynamicgraph;
......@@ -108,6 +112,23 @@ int main() {
cout << endl;
}
// check the following: "typeid of vA is different from typeid of vB
// in different shared libraries""
cout << "-- check typeid equality in shared libs" << endl;
if(typeid(vA) == typeid(vB)) {
cout << "The types of vA (libA.so) and vB (libB.so) are equal" << endl;
} else {
cout << "The types of vA (libA.so) and vB (libB.so) are different" << endl;
}
cout << "-- check type *name* equality in shared libs with type:" << endl
<< " " << typeid(vA).name() << endl;
if( !strcmp(typeid(vA).name(), typeid(vB).name()) ) {
cout << "The type names of vA (libA.so) and vB (libB.so) are equal" << endl;
} else {
cout << "The type names of vA (libA.so) and vB (libB.so) are different" << endl;
}
return 0;
}
#include <string>
#include <iostream>
#include <cstdlib>
#include <memory>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/entity.h>
#include <dynamic-graph/debug.h>
#include <dynamic-graph/pool.h>
#include <dynamic-graph/signal.h>
#include <dynamic-graph/signal-caster.h>
#include "test_signalcast_libA.h"
using namespace dynamicgraph;
using namespace std;
vec_type vA;
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
typedef boost::numeric::ublas::vector<double> vec_type;
extern vec_type vA;
#include <string>
#include <iostream>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/entity.h>
#include <dynamic-graph/debug.h>
#include <dynamic-graph/pool.h>
#include <dynamic-graph/signal.h>
#include <dynamic-graph/signal-caster.h>
#include "test_signalcast_libB.h"
using namespace dynamicgraph;
using namespace std;
vec_type vB;
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
typedef boost::numeric::ublas::vector<double> vec_type;
extern vec_type vB;
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