From a728d97bed9e5471171f3e552d3a8f9c8fd83745 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 5 Nov 2018 08:59:15 -0600 Subject: [PATCH] ENH: Stop abort on first failure. The ITKCastImageFilter test aborts on first failure. When debugging it is sometimes helpful to know all classes of failure rather than just the first failure. Change-Id: I08d48432c34df5d5aab89c8460755b3e597fcc3b --- .../test/itkCastImageFilterTest.cxx | 57 ++++++++++--------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx b/Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx index 13f1c68fb81..c7fc8fcf3d8 100644 --- a/Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx +++ b/Modules/Filtering/ImageFilterBase/test/itkCastImageFilterTest.cxx @@ -100,6 +100,7 @@ bool TestCastFromTo() if ( itk::Math::NotExactlyEquals(outValue, expectedValue) ) #endif { + std::cerr << "ERROR: " << outValue << " != " << expectedValue << std::endl; success = false; break; } @@ -124,19 +125,20 @@ bool TestCastFromTo() template < typename TInputPixelType > bool TestCastFrom() { - bool success = - TestCastFromTo< TInputPixelType, char >() && - TestCastFromTo< TInputPixelType, unsigned char >() && - TestCastFromTo< TInputPixelType, short >() && - TestCastFromTo< TInputPixelType, unsigned short >() && - TestCastFromTo< TInputPixelType, int >() && - TestCastFromTo< TInputPixelType, unsigned int >() && - TestCastFromTo< TInputPixelType, long >() && - TestCastFromTo< TInputPixelType, unsigned long >() && - TestCastFromTo< TInputPixelType, long long >() && - TestCastFromTo< TInputPixelType, unsigned long long >() && - TestCastFromTo< TInputPixelType, float >() && - TestCastFromTo< TInputPixelType, double >(); + bool success = true; + success &= TestCastFromTo< TInputPixelType, char >(); + success &= TestCastFromTo< TInputPixelType, signed char >(); + success &= TestCastFromTo< TInputPixelType, unsigned char >(); + success &= TestCastFromTo< TInputPixelType, short >(); + success &= TestCastFromTo< TInputPixelType, unsigned short >(); + success &= TestCastFromTo< TInputPixelType, int >(); + success &= TestCastFromTo< TInputPixelType, unsigned int >(); + success &= TestCastFromTo< TInputPixelType, long >(); + success &= TestCastFromTo< TInputPixelType, unsigned long >(); + success &= TestCastFromTo< TInputPixelType, long long >(); + success &= TestCastFromTo< TInputPixelType, unsigned long long >(); + success &= TestCastFromTo< TInputPixelType, float >(); + success &= TestCastFromTo< TInputPixelType, double >(); return success; } @@ -231,20 +233,21 @@ int itkCastImageFilterTest( int, char* [] ) itk::FloatingPointExceptions::Disable(); } - bool success = - TestCastFrom< char >() && - TestCastFrom< unsigned char >() && - TestCastFrom< short >() && - TestCastFrom< unsigned short >() && - TestCastFrom< int >() && - TestCastFrom< unsigned int >() && - TestCastFrom< long >() && - TestCastFrom< unsigned long >() && - TestCastFrom< long long >() && - TestCastFrom< unsigned long long >() && - TestCastFrom< float >() && - TestCastFrom< double >() && - TestVectorImageCast(); + bool success = true; + success &= TestCastFrom< char >(); + success &= TestCastFrom< signed char >(); + success &= TestCastFrom< unsigned char >(); + success &= TestCastFrom< short >(); + success &= TestCastFrom< unsigned short >(); + success &= TestCastFrom< int >(); + success &= TestCastFrom< unsigned int >(); + success &= TestCastFrom< long >(); + success &= TestCastFrom< unsigned long >(); + success &= TestCastFrom< long long >(); + success &= TestCastFrom< unsigned long long >(); + success &= TestCastFrom< float >(); + success &= TestCastFrom< double >(); + success &= TestVectorImageCast(); std::cout << std::endl; if ( !success )