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

Corrected a bug that stemmed from the renaming of GainAdaptive (thanks unit testing!)

Added unit tests for filesystem and tracing.
parent 9dfc9e86
No related branches found
No related tags found
No related merge requests found
......@@ -104,9 +104,9 @@ ENDIF(PACKAGE_REQUIREMENTS STREQUAL "")
#
# Boost
#
FIND_PACKAGE(Boost REQUIRED)
FIND_PACKAGE(Boost COMPONENTS filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
#
# pkg-config file
......
......@@ -13,6 +13,14 @@ SET(TEST_tsot_LIBS
gain-adaptive
)
SET(TEST_files_LIBS
${Boost_LIBRARIES}
)
SET(TEST_traces_LIBS
${CMAKE_INSTALL_PREFIX}/lib/plugin/tracer.so
)
#test paths and names (without .cpp extension)
SET (tests
link
......@@ -22,7 +30,9 @@ SET (tests
signal/test_dep
sot/tsot
sot/test_solverSoth
factory/test_factory)
factory/test_factory
traces/files
traces/traces)
FOREACH(test ${tests})
GET_FILENAME_COMPONENT(EXECUTABLE_NAME ${test} NAME)
......
......@@ -105,9 +105,9 @@ if( NULL==dlib )
#ifndef WIN32
dlib = dlopen(PLUGIN_LIB_INSTALL_PATH "/gain-adaptative.so", RTLD_NOW);
dlib = dlopen(PLUGIN_LIB_INSTALL_PATH "/gain-adaptive.so", RTLD_NOW);
#else
dlib = LoadLibrary (PLUGIN_LIB_INSTALL_PATH "/gain-adaptative.lib");
dlib = LoadLibrary (PLUGIN_LIB_INSTALL_PATH "/gain-adaptive.lib");
#endif
if( NULL==dlib )
{
......
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright Projet JRL 2007
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* File: test_flags.cc
* Project: sot
* Author: Nicolas Mansard
*
* Version control
* ===============
*
* $Id$
*
* Description
* ============
*
*
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//#undef WITH_OPENHRP
#include <iostream>
#include <sot-core/debug.h>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
using namespace std;
int main()
{
boost::filesystem::create_directory( "foobar" );
ofstream file( "foobar/cheeze" );
file << "tastes good!\n";
file.close();
if ( !boost::filesystem::exists( "foobar/cheeze" ) )
std::cout << "Something is rotten in foobar\n";
return 0;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright Projet JRL 2007
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* File: test_traces.cpp
* Project: sot
* Author: Nicolas Mansard
*
* Version control
* ===============
*
* $Id$
*
* Description
* ============
*
*
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#include <iostream>
#include <sot-core/debug.h>
#include <dynamic-graph/signal-base.h>
#include <dynamic-graph/signal.h>
#include <dynamic-graph/signal-time-dependent.h>
#include <dynamic-graph/tracer.h>
#include <MatrixAbstractLayer/boost.h>
namespace ml = maal::boost;
using namespace std;
using namespace dynamicgraph;
using namespace sot;
double& f( double& res,const int& t ) { cout << "SIGM!"<<endl; return res; }
int main()
{
Signal<ml::Vector,int> sig1( "sig1" );
ml::Vector v1(2); v1.fill(1.1); sig1 = v1;
Signal<ml::Vector,int> sig2( "sig2" );
ml::Vector v2(4); v2.fill(2.); sig2 = v2;
Signal<ml::Vector,int> sig3( "sig3" );
ml::Vector v3(6); v3.fill(3.); sig3 = v3;
SignalTimeDependent<double,int> sigM( f,sotNOSIGNAL,"sigM" );
sigM.access(0);
Tracer tracer( "trace" );
tracer.addSignalToTrace( sig1 );
tracer.openFiles( "/tmp/sot-core","tr_",".dat" );
tracer.addSignalToTrace( sig2 );
return 0;
}
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