Skip to content

Commit

Permalink
STYLE: Replace all occurrences in tests of (&x)->Print with x.Print
Browse files Browse the repository at this point in the history
Using a regular expression, by replacing `\(&(\w+)\)->Print` with `$1.Print`,
in all "itk*Test.cxx" files.

Aims to simplify the code.
  • Loading branch information
N-Dekker authored and dzenanz committed Jul 28, 2022
1 parent 65215a4 commit 8f5c337
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions Modules/Core/Common/test/itkByteSwapTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ itkByteSwapTest(int, char *[])
catch (const itk::ExceptionObject & err)
{
std::cout << "Caught unsigned long exception size is: " << sizeof(unsigned long) << std::endl;
(&err)->Print(std::cerr);
err.Print(std::cerr);
}


Expand All @@ -142,7 +142,7 @@ itkByteSwapTest(int, char *[])
catch (const itk::ExceptionObject & err)
{
std::cout << "Caught unsigned long long exception size is: " << sizeof(unsigned long long) << std::endl;
(&err)->Print(std::cerr);
err.Print(std::cerr);
}

try
Expand All @@ -166,7 +166,7 @@ itkByteSwapTest(int, char *[])
catch (const itk::ExceptionObject & err)
{
std::cout << "Caught float exception size is: " << sizeof(float) << std::endl;
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand All @@ -191,7 +191,7 @@ itkByteSwapTest(int, char *[])
catch (const itk::ExceptionObject & err)
{
std::cout << "Good catch! Caught double exception size is: " << sizeof(double) << std::endl;
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
// we failed to throw an exception for the double swap (once it's implemented, this should return 0
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkSliceIteratorTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ itkSliceIteratorTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return 2;
}

Expand Down
12 changes: 6 additions & 6 deletions Modules/Core/Common/test/itkVariableSizeMatrixTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

try
Expand All @@ -193,7 +193,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

try
Expand All @@ -202,7 +202,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

try
Expand All @@ -211,7 +211,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

try
Expand All @@ -220,7 +220,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

try
Expand All @@ -229,7 +229,7 @@ itkVariableSizeMatrixTest(int, char *[])
}
catch (const itk::ExceptionObject & e)
{
(&e)->Print(std::cout);
e.Print(std::cout);
}

std::cout << "[PASSED]" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ itkCurvatureAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itk
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ itkGradientAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itkN
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ itkVectorAnisotropicDiffusionImageFilterTest(int itkNotUsed(argc), char * itkNot
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ itkIsoContourDistanceImageFilterTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -164,7 +164,7 @@ itkIsoContourDistanceImageFilterTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ itkBilateralImageFilterTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ itkNeighborhoodOperatorImageFilterTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ itkVectorNeighborhoodOperatorImageFilterTest(int itkNotUsed(argc), char * itkNot
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ itkSmoothingRecursiveGaussianImageFilterOnImageAdaptorTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ itkSmoothingRecursiveGaussianImageFilterOnImageOfVectorTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ itkSmoothingRecursiveGaussianImageFilterOnVectorImageTest(int, char *[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ itkNarrowBandImageFilterBaseTest(int argc, char * argv[])
}
catch (const itk::ExceptionObject & err)
{
(&err)->Print(std::cerr);
err.Print(std::cerr);
std::cout << "Test failed." << std::endl;
return EXIT_FAILURE;
}
Expand Down

0 comments on commit 8f5c337

Please sign in to comment.