Skip to content

Commit

Permalink
STYLE: Use the itkNameOfTestExecutableMacro macro in tests
Browse files Browse the repository at this point in the history
Use the `itkNameOfTestExecutableMacro` macro to get the test name
instead of hard-coding the test name.

Left behind in 1fa53fe and in
successive related commits.
  • Loading branch information
jhlegarreta authored and N-Dekker committed Aug 8, 2023
1 parent 0595670 commit 395c8f4
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@

#include "itkImageFileReader.h"
#include "itkRGBPixel.h"
#include "itkTestingMacros.h"

int
itkImageToVTKImageFilterRGBTest(int argc, char * argv[])
{
if (argc != 2)
{
std::cerr << "Usage: ";
std::cerr << argv[0];
std::cerr << itkNameOfTestExecutableMacro(argv);
std::cerr << " <InputFileName>";
std::cerr << std::endl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
#include <sstream>
#include <map>
#include "QuickView.h"
#include "itkTestingMacros.h"

int
itkVtkConnectedComponentImageFilterTest(int argc, char * argv[])
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0];
std::cout << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cout << " inputImageFile";
std::cerr << std::endl;
return EXIT_FAILURE;
Expand Down
3 changes: 2 additions & 1 deletion Modules/Bridge/VtkGlue/test/itkVtkMedianFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <sstream>

#include "QuickView.h"
#include "itkTestingMacros.h"

int
itkVtkMedianFilterTest(int argc, char * argv[])
Expand All @@ -33,7 +34,7 @@ itkVtkMedianFilterTest(int argc, char * argv[])
if (argc < 2)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " InputImageFile [radius]" << std::endl;
std::cerr << itkNameOfTestExecutableMacro(argv) << " InputImageFile [radius]" << std::endl;
return EXIT_FAILURE;
}
std::string inputFilename = argv[1];
Expand Down
3 changes: 2 additions & 1 deletion Modules/Core/Common/test/itkDownCastTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


#include "itkDynamicLoader.h"
#include "itkTestingMacros.h"

using PRODUCER_FUNCTION = itk::Object * (*)();
using DYNAMIC_DOWNCAST_FUNCTION = int (*)(const char * type, const char * instanceSource, itk::Object const * base);
Expand All @@ -33,7 +34,7 @@ itkDownCastTest(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " <LibraryBFilePath>" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " <LibraryBFilePath>" << std::endl;
return EXIT_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "itkFFTWComplexToComplexFFTImageFilter.h"
#include "itkFFTWForwardFFTImageFilter.h"
#include "itkFFTWInverseFFTImageFilter.h"
#include "itkTestingMacros.h"

template <typename TPixel, unsigned int VDimension>
int
Expand Down Expand Up @@ -99,7 +100,8 @@ itkFFTWComplexToComplexFFTImageFilterTest(int argc, char * argv[])
{
if (argc < 4)
{
std::cerr << "Usage: " << argv[0] << " <InputImage> <OutputImage> <float|double>" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " <InputImage> <OutputImage> <float|double>"
<< std::endl;
return EXIT_FAILURE;
}
const char * inputImageFileName = argv[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ itkForward1DFFTImageFilterTest(int argc, char * argv[])
if (argc < 3)
{
std::cerr << "Missing Parameters." << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cerr << " inputImage outputImagePrefix [backend]" << std::endl;
std::cerr << "backend implementation options:" << std::endl;
std::cerr << " 0 default" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
#include "itkSubtractImageFilter.h"

#include "itkPhilipsRECImageIO.h"
#include "itkTestingMacros.h"

int
itkPhilipsRECImageIOOrientationTest(int argc, char * argv[])
{

if (argc < 4)
{
std::cerr << "Usage: " << argv[0] << " ReferenceImage TargetImage ";
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " ReferenceImage TargetImage ";
std::cerr << "OutputImage" << std::endl;
return EXIT_FAILURE;
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/IO/PhilipsREC/test/itkPhilipsRECImageIOPrintTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

#include <vxl_version.h>
#include "vnl/vnl_vector_fixed.h"
#include "itkTestingMacros.h"

int
itkPhilipsRECImageIOPrintTest(int argc, char * argv[])
{

if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " InputImage" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " InputImage" << std::endl;
return EXIT_FAILURE;
}

Expand Down
3 changes: 2 additions & 1 deletion Modules/IO/PhilipsREC/test/itkPhilipsRECImageIOTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
#include "itkImageFileWriter.h"

#include "itkPhilipsRECImageIOFactory.h"
#include "itkTestingMacros.h"

int
itkPhilipsRECImageIOTest(int argc, char * argv[])
{

if (argc < 3)
{
std::cerr << "Usage: " << argv[0] << " InputImage OutputImage" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " InputImage OutputImage" << std::endl;
return EXIT_FAILURE;
}

Expand Down
3 changes: 2 additions & 1 deletion Modules/Nonunit/IntegratedTest/test/itkBioRadImageIOTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "itkImageFileWriter.h"
#include "itkBioRadImageIO.h"
#include "itkImage.h"
#include "itkTestingMacros.h"

// Specific ImageIO test

Expand All @@ -27,7 +28,7 @@ itkBioRadImageIOTest(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << argv[0] << " BioRad.pic OutputImage.pic\n";
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " BioRad.pic OutputImage.pic\n";
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "itkComposeImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkSimpleFilterWatcher.h"
#include "itkTestingMacros.h"

template <typename TVectorImage>
int
Expand All @@ -38,7 +39,8 @@ itkImageToHistogramFilterTest4Templated(int argc, char * argv[])
if (argc < 4)
{
std::cerr << "Missing command line arguments" << std::endl;
std::cerr << "Usage : " << argv[0] << " inputImageFileName inputImageFileName outputHistogramFile" << std::endl;
std::cerr << "Usage : " << itkNameOfTestExecutableMacro(argv)
<< " inputImageFileName inputImageFileName outputHistogramFile" << std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "itkComposeImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkSimpleFilterWatcher.h"
#include "itkTestingMacros.h"

int
itkMaskedImageToHistogramFilterTest1(int argc, char * argv[])
Expand All @@ -33,7 +34,7 @@ itkMaskedImageToHistogramFilterTest1(int argc, char * argv[])
if (argc < 6)
{
std::cerr << "Missing command line arguments" << std::endl;
std::cerr << "Usage : " << argv[0]
std::cerr << "Usage : " << itkNameOfTestExecutableMacro(argv)
<< " inputImageFileName inputImageFileName maskImage maskValue outputHistogramFile" << std::endl;
return EXIT_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ itkFastApproximateRankImageFilterTest(int argc, char * argv[])
if (argc < 4)
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << argv[0] << " InputImage BaselineImage radius" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " InputImage BaselineImage radius" << std::endl;
return EXIT_FAILURE;
}

Expand Down
3 changes: 2 additions & 1 deletion Modules/Numerics/FEM/test/itkFEMSolverHyperbolicTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "itkFEMSpatialObjectReader.h"
#include "itkFEMLinearSystemWrapperDenseVNL.h"
#include "itkFEMLinearSystemWrapperItpack.h"
#include "itkTestingMacros.h"


using FEMSolverType = itk::fem::SolverHyperbolic<2>;
Expand Down Expand Up @@ -152,7 +153,7 @@ itkFEMSolverHyperbolicTest(int argc, char * argv[])

if (argc < 4)
{
std::cout << "Usage: " << argv[0];
std::cout << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cout << " input-file iterations lsw (0=VNL, 1=Dense VNL, 2=Itpack)";
std::cout << std::endl;
return EXIT_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ itkFEMFiniteDifferenceFunctionLoadTest(int argc, char * argv[])
if (argc != 2)
{
std::cerr << "Missing Parameters" << std::endl;
std::cerr << "Usage: " << argv[0] << " outputFilenamePrefix" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " outputFilenamePrefix" << std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ itkPhysicsBasedNonRigidRegistrationMethodTest(int argc, char * argv[])
if (argc != 12)
{
std::cerr << "Missing Parameters" << std::endl;
std::cerr << "Usage: " << argv[0] << " fixedImageFile"
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " fixedImageFile"
<< " movingImageFile"
<< " maskImageFile"
<< " meshFile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "itkGPUContextManager.h"
#include "itkGPUDemonsRegistrationFilter.h"
#include "itkMacro.h"
#include "itkTestingMacros.h"

namespace
{
Expand Down Expand Up @@ -112,7 +113,7 @@ itkGPUDemonsRegistrationFilterTest(int argc, char * argv[])
if (argc < 6)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cerr << " imageDimension numOfIterations ";
std::cerr << " fixedImageFile movingImageFile ";
std::cerr << " outputImageFile " << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "itkCommand.h"
#include "itkCastImageFilter.h"
#include "itkImageFileWriter.h"
#include "itkTestingMacros.h"


namespace
Expand Down Expand Up @@ -111,7 +112,7 @@ itkGPUDemonsRegistrationFilterTest2(int argc, char * argv[])
if (argc < 3)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cerr << " fixedImageFile warpedOutputImageFile" << std::endl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "itkImageRegionConstIteratorWithIndex.h"
#include "itkOpenCVVideoIOFactory.h"
#include "itkOpenCVTestHelper.h"
#include "itkTestingMacros.h"

#if defined(CV_VERSION_EPOCH) // OpenCV 2.4.x
# include "highgui.h"
Expand Down Expand Up @@ -244,7 +245,8 @@ itkOpenCVImageBridgeGrayScaleTest(int argc, char * argv[])
//
if (argc != 4)
{
std::cerr << "Usage: " << argv[0] << "scalar_image1 scalar_image2 scalar_image3" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << "scalar_image1 scalar_image2 scalar_image3"
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "itkImageRegionConstIteratorWithIndex.h"
#include "itkOpenCVVideoIOFactory.h"
#include "itkOpenCVTestHelper.h"
#include "itkTestingMacros.h"

#if defined(CV_VERSION_EPOCH) // OpenCV 2.4.x
# include "highgui.h"
Expand Down Expand Up @@ -285,7 +286,8 @@ itkOpenCVImageBridgeRGBTest(int argc, char * argv[])
//
if (argc != 4)
{
std::cerr << "Usage: " << argv[0] << "rgb_jpg_image rgb_mha_image rgb_image2" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << "rgb_jpg_image rgb_mha_image rgb_image2"
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "itkOpenCVVideoCapture.h"
#include "itkVideoFileReader.h"
#include "itkOpenCVVideoIOFactory.h"
#include "itkTestingMacros.h"

#include "opencv2/core/version.hpp"
#if !defined(CV_VERSION_EPOCH)
Expand Down Expand Up @@ -50,7 +51,7 @@ itkOpenCVVideoCaptureTest(int argc, char * argv[])
//
if (argc != 6)
{
std::cerr << "Usage: " << argv[0] << " input_video scalar_output_video RGB_output_video "
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " input_video scalar_output_video RGB_output_video "
<< "width height" << std::endl;
return EXIT_FAILURE;
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/Video/BridgeVXL/test/vidl_itk_istreamTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "vidl_itk_istream.hxx"
#include "itkVideoFileReader.h"
#include "itkVXLVideoIOFactory.h"
#include "itkTestingMacros.h"
#include "vidl/vidl_ffmpeg_ostream.h"


Expand Down Expand Up @@ -134,7 +135,7 @@ vidl_itk_istreamTest(int argc, char * argv[])
//
if (argc < 5)
{
std::cerr << "Usage: " << argv[0] << " input_file output_file width height" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " input_file output_file width height" << std::endl;
return EXIT_FAILURE;
}

Expand Down

0 comments on commit 395c8f4

Please sign in to comment.