Commit bbbe6ed0 authored by Stefan Philips's avatar Stefan Philips

[FIX] Catch Exceptions as reference as one should do (and to keep the

        compiler happy)
parent c4eb7f07
......@@ -163,12 +163,12 @@ public:
}
}
TS_ASSERT_THROWS( matrix.at( 0, 4 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( 1, 5 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( 1, 4 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( 1, 100000 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( 3, 1 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( -1, 0 ), WOutOfBounds );
TS_ASSERT_THROWS( matrix.at( 0, 4 ), const WOutOfBounds& );
TS_ASSERT_THROWS( matrix.at( 1, 5 ), const WOutOfBounds& );
TS_ASSERT_THROWS( matrix.at( 1, 4 ), const WOutOfBounds& );
TS_ASSERT_THROWS( matrix.at( 1, 100000 ), const WOutOfBounds& );
TS_ASSERT_THROWS( matrix.at( 3, 1 ), const WOutOfBounds& );
TS_ASSERT_THROWS( matrix.at( -1, 0 ), const WOutOfBounds& );
}
/**
......
......@@ -393,18 +393,18 @@ public:
// try some invalid indices, indices of a tensor of dimension 4 may only be 0, 1, 2 or 3
idx[ 3 ] = 4; // idx == [ 0, 1, 2, 4 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
// indices are cast to std::size_t (which should be unsigned)
idx[ 3 ] = -1; // idx == [ 0, 1, 2, -1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 2;
idx[ 0 ] = 4537; // idx == [ 4537, 1, 2, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = -434; // idx == [ -434, 1, 2, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
// some indices that should be valid
idx[ 0 ] = 3;
......@@ -446,10 +446,10 @@ public:
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
idx[ 0 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 4537;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 1;
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -473,14 +473,14 @@ public:
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
idx[ 2 ] = 3;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 2 ] = 2;
idx[ 0 ] = 4537;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 0;
idx[ 1 ] = 1;
......@@ -651,14 +651,14 @@ public:
std::vector< int > idx;
// this should throw a WException (using the WAssert macro)
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 ); // idx == [ 0, 1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 2 ); // idx == [ 0, 1, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 3 ); // idx == [ 0, 1, 2, 3 ]
// now idx has the correct size and all valid indices
......@@ -677,17 +677,17 @@ public:
// which is called by the vector version
// I'll add some tests here though, in case this changes in the future
idx[ 0 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 3;
idx[ 3 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 2;
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -696,7 +696,7 @@ public:
T14 t;
std::vector< int > idx;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -714,18 +714,18 @@ public:
T62 t;
std::vector< int > idx;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 ); // idx == [ 0, 1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0, 1, 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 );
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 );
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 );
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -1327,18 +1327,18 @@ public:
// try some invalid indices, indices of a tensor of dimension 4 may only be 0, 1, 2 or 3
idx[ 3 ] = 4; // idx == [ 0, 1, 2, 4 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
// indices are cast to std::size_t (which should be unsigned)
idx[ 3 ] = -1; // idx == [ 0, 1, 2, -1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 2;
idx[ 0 ] = 4537; // idx == [ 4537, 1, 2, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = -434; // idx == [ -434, 1, 2, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
// some indices that should be valid
idx[ 0 ] = 3;
......@@ -1380,10 +1380,10 @@ public:
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
idx[ 0 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 4537;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 1;
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -1407,14 +1407,14 @@ public:
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
idx[ 2 ] = 3;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 2 ] = 2;
idx[ 0 ] = 4537;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 0;
idx[ 1 ] = 1;
......@@ -1642,14 +1642,14 @@ public:
std::vector< int > idx;
// this should throw a WException (using the WAssert macro)
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 ); // idx == [ 0, 1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 2 ); // idx == [ 0, 1, 2 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 3 ); // idx == [ 0, 1, 2, 3 ]
// now idx has the correct size and all valid indices
......@@ -1668,17 +1668,17 @@ public:
// which is called by the vector version
// I'll add some tests here though, in case this changes in the future
idx[ 0 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 0 ] = 3;
idx[ 3 ] = -1;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 4;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx[ 3 ] = 2;
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -1687,7 +1687,7 @@ public:
T14 t;
std::vector< int > idx;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -1705,18 +1705,18 @@ public:
T62 t;
std::vector< int > idx;
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 ); // idx == [ 0, 1 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 ); // idx == [ 0, 1, 0 ]
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 );
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 1 );
TS_ASSERT_THROWS( t[ idx ], WException );
TS_ASSERT_THROWS( t[ idx ], const WException& );
idx.push_back( 0 );
TS_ASSERT_THROWS_NOTHING( t[ idx ] );
......@@ -1979,12 +1979,12 @@ public:
// try some invalid indices
// negative indices are not allowed as the parameters are of type std::size_t
TS_ASSERT_THROWS( f( 0, 0, 3 ), WException );
TS_ASSERT_THROWS( f( 0, 654465, 0 ), WException );
TS_ASSERT_THROWS( f( 4, 0, 0 ), WException );
TS_ASSERT_THROWS( f( 0, 0, 45 ), WException );
TS_ASSERT_THROWS( f( 0, 64, 0 ), WException );
TS_ASSERT_THROWS( f( 792, 981, 5645 ), WException );
TS_ASSERT_THROWS( f( 0, 0, 3 ), const WException& );
TS_ASSERT_THROWS( f( 0, 654465, 0 ), const WException& );
TS_ASSERT_THROWS( f( 4, 0, 0 ), const WException& );
TS_ASSERT_THROWS( f( 0, 0, 45 ), const WException& );
TS_ASSERT_THROWS( f( 0, 64, 0 ), const WException& );
TS_ASSERT_THROWS( f( 792, 981, 5645 ), const WException& );
}
{
F15 f;
......@@ -1995,8 +1995,8 @@ public:
TS_ASSERT_THROWS_NOTHING( f( 3 ) );
TS_ASSERT_THROWS_NOTHING( f( 4 ) );
TS_ASSERT_THROWS( f( 5 ), WException );
TS_ASSERT_THROWS( f( 5436 ), WException );
TS_ASSERT_THROWS( f( 5 ), const WException& );
TS_ASSERT_THROWS( f( 5436 ), const WException& );
}
// now try a symmetric tensor base
......@@ -2011,8 +2011,8 @@ public:
TS_ASSERT_THROWS_NOTHING( f( 3, 3 ) );
TS_ASSERT_THROWS_NOTHING( f( 0, 1 ) );
TS_ASSERT_THROWS( f( 4, 0 ), WException );
TS_ASSERT_THROWS( f( 3, 457 ), WException );
TS_ASSERT_THROWS( f( 4, 0 ), const WException& );
TS_ASSERT_THROWS( f( 3, 457 ), const WException& );
}
}
......
......@@ -98,7 +98,7 @@ public:
// add a malformed (name) property
// The name is malformed since the "/" is used as group separator
TS_ASSERT_THROWS( p->addProperty( "4/5", "test4", 1.0 ), WPropertyNameMalformed );
TS_ASSERT_THROWS( p->addProperty( "4/5", "test4", 1.0 ), const WPropertyNameMalformed& );
// this should have created 3 props
TS_ASSERT( p->m_properties.getReadTicket()->get().size() == 3 );
......@@ -109,7 +109,7 @@ public:
TS_ASSERT( p3->getType() == PV_DOUBLE );
// try to add another property with the same name ( regardless of actual type )
TS_ASSERT_THROWS( p->addProperty( "1", "test1", 1.0 ), WPropertyNotUnique );
TS_ASSERT_THROWS( p->addProperty( "1", "test1", 1.0 ), const WPropertyNotUnique& );
}
/**
......@@ -249,7 +249,7 @@ public:
TS_ASSERT( someProp );
// this one does not exist
TS_ASSERT_THROWS( someProp = p->getProperty( "shouldNotBeInTheList" ), WPropertyUnknown );
TS_ASSERT_THROWS( someProp = p->getProperty( "shouldNotBeInTheList" ), const WPropertyUnknown& );
}
/**
......@@ -267,7 +267,7 @@ public:
boost::shared_ptr< WPropertyBase > p4 = psub->addProperty( "4", "test4", std::string( "hello" ) );
// insert a prop with the same name as a sub property
TS_ASSERT_THROWS( p->addProperty( "heySub", "test1", true ), WPropertyNotUnique );
TS_ASSERT_THROWS( p->addProperty( "heySub", "test1", true ), const WPropertyNotUnique& );
/////////////
// exists
......@@ -301,7 +301,7 @@ public:
TS_ASSERT_THROWS_NOTHING( p->getProperty( "heySub/4" ) );
// ensure nothing is found if wrong name is specified
TS_ASSERT_THROWS( p->getProperty( "heySub/1" ), WPropertyUnknown );
TS_ASSERT_THROWS( p->getProperty( "heySub/1" ), const WPropertyUnknown& );
}
/**
......
......@@ -94,7 +94,7 @@ public:
boost::shared_ptr< WPropertyVariable< bool > > p;
TS_ASSERT_THROWS( p = boost::shared_ptr< WPropertyVariable< bool > >( new WPropertyVariable< bool >( "hey/you", "you", false ) ),
WPropertyNameMalformed );
const WPropertyNameMalformed& );
}
/**
......
......@@ -57,11 +57,11 @@ public:
TS_ASSERT_THROWS( parseFromFile(
boost::filesystem::path( W_FIXTURE_PATH + "WStructuredTextParser_test_invalid.txt" )
), WParseError );
), const WParseError& );
TS_ASSERT_THROWS( parseFromFile(
boost::filesystem::path( W_FIXTURE_PATH + "WStructuredTextParser_test_doesnotexist.txt" )
), WFileNotFound );
), const WFileNotFound& );
// NOTE: we do not test parseFromString as both use the same backend functionality
}
......@@ -170,11 +170,11 @@ public:
TS_ASSERT( t.getValues< std::string >( "level0/notexists" ).size() == 0 );
// check operator[] (it uses getValue internally. So we only check for the WNotFound exception)
TS_ASSERT_THROWS( t.operator[]< std::string >( "level0/notexists" ), WNotFound );
TS_ASSERT_THROWS( t.operator[]< std::string >( "level0/notexists" ), const WNotFound& );
// check type conversion
// this is valid for getValue, getValues and [] as they utilize the same function
TS_ASSERT_THROWS( t.operator[]< size_t >( "level0/notuniquekv" ), WTypeMismatch );
TS_ASSERT_THROWS( t.operator[]< size_t >( "level0/notuniquekv" ), const WTypeMismatch& );
TS_ASSERT( t.operator[]< size_t >( "level0/level1/somekv" ) == 123 );
// to ensure case sensitivity:
......
......@@ -202,7 +202,7 @@ public:
void testNoFunction()
{
boost::shared_ptr< FuncType > func;
TS_ASSERT_THROWS( WWorkerThread< FuncType > w( func, 0, 1 ), WException );
TS_ASSERT_THROWS( WWorkerThread< FuncType > w( func, 0, 1 ), const WException& );
}
/**
......@@ -211,7 +211,7 @@ public:
void testThreadId()
{
boost::shared_ptr< FuncType > func( new FuncType( 5 ) );
TS_ASSERT_THROWS( WWorkerThread< FuncType > w( func, 1, 0 ), WException );
TS_ASSERT_THROWS( WWorkerThread< FuncType > w( func, 1, 0 ), const WException& );
}
// restore WASSERT_AS_CASSERT flag
#ifdef WASSERT_FLAG_CHANGED
......
......@@ -64,23 +64,23 @@ public:
TimesVector t;
// test what happens when the input is empty
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when the vector sizes don't match
createData( data, 3, d, t );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t.push_back( 4.0f );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when there is an invalid time value
t.resize( 3 );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t[ 2 ] = -0.0 / 0.0;
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when there are equal time values
t[ 2 ] = t[ 1 ];
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens if the grids don't match
t[ 2 ] = 2.0;
......@@ -100,7 +100,7 @@ public:
boost::shared_ptr< WValueSet< double > > vs( new WValueSet< double >( 0, 1, v, W_DT_DOUBLE ) );
d.push_back( boost::shared_ptr< WDataSetScalar const >( new WDataSetScalar( vs, g ) ) );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens if the valuesets data types don't match
d.resize( 3 );
......@@ -111,7 +111,7 @@ public:
boost::shared_ptr< std::vector< float > > v2( new std::vector< float >( 27, 4 ) );
boost::shared_ptr< WValueSet< float > > vs2( new WValueSet< float >( 0, 1, v2, W_DT_FLOAT ) );
d.push_back( boost::shared_ptr< WDataSetScalar const >( new WDataSetScalar( vs2, d.front()->getGrid() ) ) );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
}
// test with 2 time slices
......@@ -121,23 +121,23 @@ public:
TimesVector t;
// test what happens when the input is empty
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when the vector sizes don't match
createData( data, 2, d, t );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t.push_back( 4.0f );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when there is an invalid time value
t.resize( 2 );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t[ 1 ] = 0.0f / 0.0f;
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when there are equal time values
t[ 1 ] = t[ 0 ];
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens if the grids don't match
t[ 1 ] = 2.0;
......@@ -157,7 +157,7 @@ public:
boost::shared_ptr< WValueSet< double > > vs( new WValueSet< double >( 0, 1, v, W_DT_DOUBLE ) );
d.push_back( boost::shared_ptr< WDataSetScalar const >( new WDataSetScalar( vs, g ) ) );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens if the valuesets data types don't match
d.resize( 2 );
......@@ -168,7 +168,7 @@ public:
boost::shared_ptr< std::vector< float > > v2( new std::vector< float >( 27, 4 ) );
boost::shared_ptr< WValueSet< float > > vs2( new WValueSet< float >( 0, 1, v2, W_DT_FLOAT ) );
d.push_back( boost::shared_ptr< WDataSetScalar const >( new WDataSetScalar( vs2, d.front()->getGrid() ) ) );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
}
// test with 1 time slice
......@@ -178,19 +178,19 @@ public:
TimesVector t;
// test what happens when the input is empty
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when the vector sizes don't match
createData( data, 1, d, t );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t.push_back( 4.0f );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
// test what happens when there is an invalid time value
t.resize( 1 );
TS_ASSERT_THROWS_NOTHING( WDataSetTimeSeries( d, t ) );
t[ 0 ] = -0.0f / 0.0f;
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), WException );
TS_ASSERT_THROWS( WDataSetTimeSeries( d, t ), const WException& );
}
// datasets should be sorted by time
......@@ -325,7 +325,7 @@ public:
TS_ASSERT_EQUALS( 2.0f, f );
f = ts.findNearestTimeSlice( std::numeric_limits< float >::infinity() );
TS_ASSERT_EQUALS( 2.0f, f );
TS_ASSERT_THROWS( ts.findNearestTimeSlice( 0.0 / 0.0 ), WException );
TS_ASSERT_THROWS( ts.findNearestTimeSlice( 0.0 / 0.0 ), const WException& );
}
/**
......@@ -444,15 +444,15 @@ public:
// test invalid times
WVector3d pos( 1.0, 0.5, 1.0 );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -inf, &success ), WException );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -inf, &success ), const WException& );
TS_ASSERT( !success );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -3.0f, &success ), WException );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -3.0f, &success ), const WException& );
TS_ASSERT( !success );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -wlimits::FLT_EPS, &success ), WException );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, -wlimits::FLT_EPS, &success ), const WException& );
TS_ASSERT( !success );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, 2.0f + 2.0f * wlimits::FLT_EPS, &success ), WException );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, 2.0f + 2.0f * wlimits::FLT_EPS, &success ), const WException& );
TS_ASSERT( !success );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, inf, &success ), WException );
TS_ASSERT_THROWS( h = ts.interpolate< double >( pos, inf, &success ), const WException& );
TS_ASSERT( !success );
// test invalid position
......
......@@ -66,9 +66,9 @@ public:
}
{
TS_ASSERT_THROWS_NOTHING( WGridTransformOrtho v( 2.2, 3.3, -1.0 ) );
TS_ASSERT_THROWS( WGridTransformOrtho v( 0.0, 0.0, 1.0 ), WPreconditionNotMet );
TS_ASSERT_THROWS( WGridTransformOrtho v( 0.0, 2.0, 1.0 ), WPreconditionNotMet );
TS_ASSERT_THROWS( WGridTransformOrtho v( 1.0, 1.0, 0.0 ), WPreconditionNotMet );
TS_ASSERT_THROWS( WGridTransformOrtho v( 0.0, 0.0, 1.0 ), const WPreconditionNotMet& );
TS_ASSERT_THROWS( WGridTransformOrtho v( 0.0, 2.0, 1.0 ), const WPreconditionNotMet& );
TS_ASSERT_THROWS( WGridTransformOrtho v( 1.0, 1.0, 0.0 ), const WPreconditionNotMet& );
}
{
WGridTransformOrtho v( 2.2, 3.3, -1.0 );
......@@ -90,7 +90,7 @@ public:
mat( 1, 1 ) = 3.3;
mat( 2, 2 ) = 0.0;
TS_ASSERT_THROWS( WGridTransformOrtho v( mat ), WPreconditionNotMet );
TS_ASSERT_THROWS( WGridTransformOrtho v( mat ), const WPreconditionNotMet& );
}
{
WMatrix< double > mat( 4, 4 );
......@@ -100,7 +100,7 @@ public:
mat( 1, 1 ) = 3.3;
mat( 2, 2 ) = 1.0;
TS_ASSERT_THROWS( WGridTransformOrtho v( mat ), WPreconditionNotMet );
TS_ASSERT_THROWS( WGridTransformOrtho v( mat ), const WPreconditionNotMet& );
}
{
WMatrix< double > mat( 4, 4 );
......
......@@ -72,14 +72,14 @@ public:
boost::shared_ptr< WDataSetSingle > ds = buildTestData();
TS_ASSERT_THROWS( TPVO t( boost::shared_ptr< WDataSetSingle >(),
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), WException );
TS_ASSERT_THROWS( TPVO t( ds, TPVO::FunctionType() ), WException );
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), const WException& );
TS_ASSERT_THROWS( TPVO t( ds, TPVO::FunctionType() ), const WException& );
TS_ASSERT_THROWS( TPVO t( boost::shared_ptr< WDataSetSingle >( new WDataSetSingle( ds->getValueSet(),
boost::shared_ptr< WGrid >() ) ),
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), WException );
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), const WException& );
TS_ASSERT_THROWS( TPVO t( boost::shared_ptr< WDataSetSingle >( new WDataSetSingle( boost::shared_ptr< WValueSetBase >(),
ds->getGrid() ) ),
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), WException );
boost::bind( &WThreadedPerVoxelOperationTest::func, this, _1 ) ), const WException& );