diff --git a/src/TNL/Containers/StaticArray_impl.h b/src/TNL/Containers/StaticArray_impl.h index 2a9f463475bc62b0e70b42045b698cc6116936e1..9c7835ce82c47b62057c0ba1ee519102112f4db9 100644 --- a/src/TNL/Containers/StaticArray_impl.h +++ b/src/TNL/Containers/StaticArray_impl.h @@ -160,22 +160,14 @@ inline void StaticArray< Size, Value >::setValue( const ValueType& val ) template< int Size, typename Value > bool StaticArray< Size, Value >::save( File& file ) const { - if( ! file.save< Value, Value, Devices::Host >( data, size ) ) - { - std::cerr << "Unable to write " << getType() << "." << std::endl; - return false; - } + file.save< Value, Value, Devices::Host >( data, size ); return true; } template< int Size, typename Value > bool StaticArray< Size, Value >::load( File& file) { - if( ! file.load< Value, Value, Devices::Host >( data, size ) ) - { - std::cerr << "Unable to read " << getType() << "." << std::endl; - return false; - } + file.load< Value, Value, Devices::Host >( data, size ); return true; } diff --git a/src/UnitTests/FileTest.h b/src/UnitTests/FileTest.h index 17d2df6ed7c92bf84f90e923b993aea7bc788d44..39671ba661ca77add041345206c9fd2926ce2879 100644 --- a/src/UnitTests/FileTest.h +++ b/src/UnitTests/FileTest.h @@ -29,18 +29,18 @@ TEST( FileTest, WriteAndRead ) int intData( 5 ); double doubleData[ 3 ] = { 1.0, 2.0, 3.0 }; const double constDoubleData = 3.14; - ASSERT_TRUE( file.save( &intData ) ); - ASSERT_TRUE( file.save( doubleData, 3 ) ); - ASSERT_TRUE( file.save( &constDoubleData ) ); + file.save( &intData ); + file.save( doubleData, 3 ); + file.save( &constDoubleData ); file.close(); file.open( String( "test-file.tnl" ), File::Mode::In ); int newIntData; double newDoubleData[ 3 ]; double newConstDoubleData; - ASSERT_TRUE( file.load( &newIntData, 1 ) ); - ASSERT_TRUE( file.load( newDoubleData, 3 ) ); - ASSERT_TRUE( file.load( &newConstDoubleData, 1 ) ); + file.load( &newIntData, 1 ); + file.load( newDoubleData, 3 ); + file.load( &newConstDoubleData, 1 ); EXPECT_EQ( newIntData, intData ); for( int i = 0; i < 3; i ++ ) @@ -110,12 +110,9 @@ TEST( FileTest, WriteAndReadCUDA ) File file; file.open( String( "test-file.tnl" ), File::Mode::Out ); - bool status = file.save< int, int, Devices::Cuda >( cudaIntData ); - ASSERT_TRUE( status ); - status = file.save< float, float, Devices::Cuda >( cudaFloatData, 3 ); - ASSERT_TRUE( status ); - status = file.save< const double, double, Devices::Cuda >( cudaConstDoubleData ); - ASSERT_TRUE( status ); + file.save< int, int, Devices::Cuda >( cudaIntData ); + file.save< float, float, Devices::Cuda >( cudaFloatData, 3 ); + file.save< const double, double, Devices::Cuda >( cudaConstDoubleData ); file.close(); file.open( String( "test-file.tnl" ), File::Mode::In ); @@ -128,12 +125,9 @@ TEST( FileTest, WriteAndReadCUDA ) cudaMalloc( ( void** ) &newCudaIntData, sizeof( int ) ); cudaMalloc( ( void** ) &newCudaFloatData, 3 * sizeof( float ) ); cudaMalloc( ( void** ) &newCudaDoubleData, sizeof( double ) ); - status = file.load< int, int, Devices::Cuda >( newCudaIntData, 1 ); - ASSERT_TRUE( status ); - status = file.load< float, float, Devices::Cuda >( newCudaFloatData, 3 ); - ASSERT_TRUE( status ); - status = file.load< double, double, Devices::Cuda >( newCudaDoubleData, 1 ); - ASSERT_TRUE( status ); + file.load< int, int, Devices::Cuda >( newCudaIntData, 1 ); + file.load< float, float, Devices::Cuda >( newCudaFloatData, 3 ); + file.load< double, double, Devices::Cuda >( newCudaDoubleData, 1 ); cudaMemcpy( &newIntData, newCudaIntData, sizeof( int ),