Commit d82ca2af authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[FIX] - as WDataTexture3D now uses the logger during construction, several...

[FIX] - as WDataTexture3D now uses the logger during construction, several tests without initialized logger seg-faulted. This is now fixed.
parent 5f9b0a43
......@@ -30,14 +30,27 @@
#include <cxxtest/TestSuite.h>
#include "../../../common/WLogger.h"
#include "../WJoinContourTree.h"
/**
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* Unit tests the Join Tree of the Contour Tree!
*/
class WJoinContourTreeTest : public CxxTest::TestSuite
{
public:
/**
* TODO(lmath): Document this!
*/
......@@ -118,6 +131,17 @@ protected:
*/
void setUp( void )
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
// ISO Values: Point id's:
// 2--- 4--- 8---14 12---13---14---15
// | | | | | | | |
......
......@@ -29,14 +29,43 @@
#include <cxxtest/TestSuite.h>
#include "../../common/WLogger.h"
#include "../WDataSetScalar.h"
/**
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* Tests for the data set type containing only scalars.
*/
class WDataSetScalarTest : public CxxTest::TestSuite
{
public:
/**
* Constructs unit test environment.
*/
void setUp( void )
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
}
/**
* Test if the interpolate function works reasonable.
*/
......
......@@ -35,6 +35,17 @@
#include "../WGrid.h"
#include "../WGridRegular3D.h"
#include "../WDataHandlerEnums.h"
#include "../../common/WLogger.h"
/**
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* Test important functionality of WDataSetSingle class
......@@ -50,6 +61,17 @@ public:
*/
void setUp( void )
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
// create dummies, since they are needed in almost every test
gridDummy = boost::shared_ptr< WGrid >( new WGridRegular3D( 1, 1, 1, 1, 1, 1 ) );
std::vector< int8_t > data( 1, 1 );
......
......@@ -29,14 +29,43 @@
#include <cxxtest/TestSuite.h>
#include "../../common/WLogger.h"
#include "../WDataSetVector.h"
/**
* TODO(lmath): Document this!
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* Test basic functionality of WDataSetVector.
*/
class WDataSetVectorTest : public CxxTest::TestSuite
{
public:
/**
* Constructs unit test environment.
*/
void setUp( void )
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
}
/**
* An interpolate of an vector is as if every components were interpolated
*/
......
......@@ -28,10 +28,21 @@
#include <vector>
#include "../../common/WThreadedFunction.h"
#include "../../common/WLogger.h"
#include "../WDataHandlerEnums.h"
#include "../WDataSetSingle.h"
#include "../WThreadedPerVoxelOperation.h"
/**
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* \class WThreadedPerVoxelOperationTest
*
......@@ -52,6 +63,24 @@ class WThreadedPerVoxelOperationTest : public CxxTest::TestSuite
typedef TPVO::OutTransmitType OutArrayType;
public:
/**
* Constructs unit test environment.
*/
void setUp( void )
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
}
/**
* Test if everything gets instantiated correctly or if
* incorrect values properly lead to exceptions.
......
......@@ -88,10 +88,32 @@ public:
* \param i The position of the value.
* \return The value at position i.
*/
virtual double getScalarDouble( size_t i ) const
virtual double getScalarDouble( size_t /* i */ ) const
{
return 255;
}
/**
* This method returns the smallest value in the valueset. It does not handle vectors, matrices and so on well. It simply returns the
* smallest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).
*
* \return the smallest value in the data.
*/
virtual double getMinimumValue() const
{
return 0.0;
}
/**
* This method returns the largest value in the valueset. It does not handle vectors, matrices and so on well. It simply returns the
* largest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).
*
* \return the largest value in the data.
*/
virtual double getMaximumValue() const
{
return 255.0;
}
};
/**
......
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