25 #ifndef WCSVCONVERTER_TEST_H
26 #define WCSVCONVERTER_TEST_H
34 #include <cxxtest/TestSuite.h>
36 #include "../../data/io/WReaderCSV.h"
37 #include "../../transferFunctionColorBar/WMTransferFunctionColorBar.h"
38 #include "../WCsvConverter.h"
39 #include "../WMFilterProtonData.h"
40 #include "core/kernel/WModuleFactory.h"
73 WReaderCSV csvReader( W_FIXTURE_PATH +
"../data/CSVs/valid.csv" );
74 std::shared_ptr< WDataSetCSV > csvDataSet = csvReader.
read();
109 TS_ASSERT_DELTA( tmpCsvReader.
getClusterSize( 1.0f ), 36.11878927498844f, 1e-5 );
110 TS_ASSERT_DELTA( tmpCsvReader.
getClusterSize( 1.0001f ), 36.1203073289856f, 1e-5 );
113 TS_ASSERT( std::isnan( tmpCsvReader.
getClusterSize( -0.0001f ) ) );
122 std::map< std::string, double > testDoubleMap;
123 testDoubleMap.insert( std::pair< std::string, double >(
"1000.1", 1000.1f ) );
124 testDoubleMap.insert( std::pair< std::string, double >(
"1.", 1.0f ) );
125 testDoubleMap.insert( std::pair< std::string, double >(
".1", 0.1f ) );
126 testDoubleMap.insert( std::pair< std::string, double >(
"2.1", 2.1f ) );
127 testDoubleMap.insert( std::pair< std::string, double >(
"+1", 1.0f ) );
128 testDoubleMap.insert( std::pair< std::string, double >(
"-1", -1.0f ) );
129 testDoubleMap.insert( std::pair< std::string, double >(
"+.1", 0.1f ) );
130 testDoubleMap.insert( std::pair< std::string, double >(
"-.1", -0.1f ) );
131 testDoubleMap.insert( std::pair< std::string, double >(
"+1e-1", 0.1f ) );
132 testDoubleMap.insert( std::pair< std::string, double >(
"0.001e-6", 0.000000001f ) );
133 testDoubleMap.insert( std::pair< std::string, double >(
"0.111111111111111", 0.111111111111111f ) );
137 for( std::pair< std::string, double > stringDoublePair : testDoubleMap )
139 TS_ASSERT_EQUALS( tmpCsvReader.
stringToDouble( stringDoublePair.first ),
140 stringDoublePair.second );
154 std::map< std::string, int > testIntMap;
155 testIntMap.insert( std::pair< std::string, int >(
"1", 1 ) );
156 testIntMap.insert( std::pair< std::string, int >(
"0", 0 ) );
157 testIntMap.insert( std::pair< std::string, int >(
"10", 10 ) );
158 testIntMap.insert( std::pair< std::string, int >(
"+1", 1 ) );
159 testIntMap.insert( std::pair< std::string, int >(
"-1", -1 ) );
160 testIntMap.insert( std::pair< std::string, int >(
"1e-1", 0 ) );
161 testIntMap.insert( std::pair< std::string, int >(
"1e1", 10 ) );
162 testIntMap.insert( std::pair< std::string, int >(
"+1e-1", 0 ) );
163 testIntMap.insert( std::pair< std::string, int >(
"0.001e-6", 0 ) );
164 testIntMap.insert( std::pair< std::string, int >(
"0.111111111111111", 0 ) );
168 for( std::pair< std::string, int > stringIntPair : testIntMap )
170 TS_ASSERT_EQUALS( tmpCsvReader.
stringToInt( stringIntPair.first ),
171 stringIntPair.second );
Creates, updates and handles the column properties.
std::shared_ptr< WColumnPropertyHandler > SPtr
shared_ptr that points to itself
Test class of WCsvConverter class.
std::shared_ptr< WPropertyStatus > m_propertyStatus
The property status.
void testStringToDouble()
Tests the method stringToDouble()
void testConstructorThrowNothing()
Test the constructors of WCsvConverter, so no exception is thrown, when input parameters are correct.
void testGetClusterSize()
Tests the method getClusterSize()
std::shared_ptr< WProperties > m_properties
the property group
void testStringToInt()
Tests the method stringToInt()
WProtonData::SPtr m_protonData
The protondata.
WModule::SPtr m_colorBar
The color bar.
void setUp()
Setup variables and data, needed for each test.
Converts the csv data to points and fibers.
float stringToDouble(std::string str)
checks whether the string is a number (double)
int stringToInt(std::string str)
checks whether the string is a number (int)
float getClusterSize(float edep)
Computes the cluster size.
Creates, updates and handles the EventID properties.
std::shared_ptr< WEventIDLimitationPropertyHandler > SPtr
shared_ptr that points to itself
Creates, updates and handles the filter properties.
std::shared_ptr< WFilterPropertyHandler > SPtr
Function variables for updating the data.
This module simply registers the given dataset to the texture handling mechanism.
std::shared_ptr< WModule > SPtr
Shared pointer to a WModule.
Holds references to all the property handlers.
std::shared_ptr< WProtonData > SPtr
shared_ptr that points to itself
Read content from a CSV file.
virtual std::shared_ptr< WDataSetCSV > read()
Read the file and create a dataset as a vector.
Creates, updates and handles the visualization properties.
std::shared_ptr< WVisualizationPropertyHandler > SPtr
shared_ptr that points to itself