00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef WDATASETSINGLE_TEST_H
00026 #define WDATASETSINGLE_TEST_H
00027
00028 #include <stdint.h>
00029 #include <vector>
00030
00031 #include <cxxtest/TestSuite.h>
00032
00033 #include "../WDataSetSingle.h"
00034 #include "../WValueSet.h"
00035 #include "../WGrid.h"
00036 #include "../WGridRegular3D.h"
00037 #include "../WDataHandlerEnums.h"
00038 #include "../../common/WLogger.h"
00039
00040
00041
00042
00043 class WDataSetSingleTest : public CxxTest::TestSuite
00044 {
00045 public:
00046 boost::shared_ptr< WGrid > gridDummy;
00047 boost::shared_ptr< WValueSetBase > valueSetDummy;
00048
00049
00050
00051
00052 void setUp( void )
00053 {
00054 WLogger::startup();
00055
00056
00057 gridDummy = boost::shared_ptr< WGrid >( new WGridRegular3D( 1, 1, 1 ) );
00058 boost::shared_ptr< std::vector< int8_t > > data = boost::shared_ptr< std::vector< int8_t > >( new std::vector< int8_t >( 1, 1 ) );
00059 valueSetDummy = boost::shared_ptr< WValueSet< int8_t > >( new WValueSet< int8_t >( 0, 1, data, W_DT_INT8 ) );
00060 }
00061
00062
00063
00064
00065 void testInstantiation( void )
00066 {
00067 TS_ASSERT_THROWS_NOTHING( WDataSetSingle ds( valueSetDummy, gridDummy ) );
00068 }
00069
00070
00071
00072
00073 void testGetValueSet( void )
00074 {
00075 boost::shared_ptr< std::vector< double > > data = boost::shared_ptr< std::vector< double > >( new std::vector< double >( 1, 3.1415 ) );
00076 boost::shared_ptr< WValueSet< double > > other;
00077 other = boost::shared_ptr< WValueSet< double > >( new WValueSet< double >( 0, 1, data, W_DT_DOUBLE ) );
00078 WDataSetSingle dataSetSingle( valueSetDummy, gridDummy );
00079 TS_ASSERT_EQUALS( dataSetSingle.getValueSet(), valueSetDummy );
00080 TS_ASSERT_DIFFERS( dataSetSingle.getValueSet(), other );
00081 }
00082
00083
00084
00085
00086 void testGetGrid( void )
00087 {
00088 boost::shared_ptr< WGrid > other = boost::shared_ptr< WGridRegular3D >( new WGridRegular3D( 1, 1, 1 ) );
00089 WDataSetSingle dataSetSingle( valueSetDummy, gridDummy );
00090 TS_ASSERT_EQUALS( dataSetSingle.getGrid(), gridDummy );
00091 TS_ASSERT_DIFFERS( dataSetSingle.getGrid(), other );
00092 }
00093 };
00094 #endif // WDATASETSINGLE_TEST_H