Skip to content

Commit 706ff72

Browse files
jhlegarretadzenanz
authored andcommitted
STYLE: Use the itkNameOfTestExecutableMacro macro in tests
Use the `itkNameOfTestExecutableMacro` macro to get the test name instead of hard-coding the test name.
1 parent ca4babd commit 706ff72

17 files changed

+36
-28
lines changed

Modules/Core/Common/test/itkCMakeConfigurationTest.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <sys/stat.h>
3636
#include <ctime>
3737
#include <cstring>
38+
#include "itkTestingMacros.h"
3839

3940
void
4041
itkCMakeInformationPrintFile(const char * name, std::ostream & os)
@@ -74,7 +75,7 @@ main(int argc, char * argv[])
7475
{
7576
if (argc != 2)
7677
{
77-
std::cerr << "Usage: itkCMakeInformationTest <top-of-build-tree>\n";
78+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " <top-of-build-tree>\n";
7879
return EXIT_FAILURE;
7980
}
8081
std::string build_dir = argv[1];

Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionOnVectorSpeedTest.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "itkCentralDifferenceImageFunction.h"
2020
#include "itkImageRegionIteratorWithIndex.h"
21+
#include "itkTestingMacros.h"
2122

2223
template <unsigned int vecLength>
2324
int
@@ -125,7 +126,8 @@ itkCentralDifferenceImageFunctionOnVectorSpeedTest(int argc, char * argv[])
125126
{
126127
if (argc != 7)
127128
{
128-
std::cerr << "usage: size reps doEAI doEACI doE vecLength" << std::endl;
129+
std::cerr << "usage: " << itkNameOfTestExecutableMacro(argv) << " size reps doEAI doEACI doE vecLength"
130+
<< std::endl;
129131
return EXIT_FAILURE;
130132
}
131133
int vecLength = std::stoi(argv[6]);

Modules/Core/ImageFunction/test/itkCentralDifferenceImageFunctionSpeedTest.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
#include "itkCentralDifferenceImageFunction.h"
2020
#include "itkImageRegionIteratorWithIndex.h"
21+
#include "itkTestingMacros.h"
2122

2223
int
2324
itkCentralDifferenceImageFunctionSpeedTest(int argc, char * argv[])
2425
{
2526
if (argc != 6)
2627
{
27-
std::cerr << "usage: size reps doEAI doEACI doE" << std::endl;
28+
std::cerr << "usage: " << itkNameOfTestExecutableMacro(argv) << " size reps doEAI doEACI doE" << std::endl;
2829
return EXIT_FAILURE;
2930
}
3031

Modules/Filtering/ImageFeature/test/itkMaskFeaturePointSelectionFilterTest.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "itkImageFileReader.h"
2727
#include "itkImageFileWriter.h"
2828
#include "itkRGBPixel.h"
29+
#include "itkTestingMacros.h"
2930

3031

3132
int
@@ -34,7 +35,7 @@ itkMaskFeaturePointSelectionFilterTest(int argc, char * argv[])
3435
if (argc < 2)
3536
{
3637
std::cerr << "Usage: " << std::endl;
37-
std::cerr << " itkMaskFeaturePointSelectionFilterTest inputImageFile outputImageFile [Mask File] ";
38+
std::cerr << itkNameOfTestExecutableMacro(argv) << " inputImageFile outputImageFile [Mask File] ";
3839
return EXIT_FAILURE;
3940
}
4041

Modules/Filtering/ImageFeature/test/itkUnsharpMaskImageFilterTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ itkUnsharpMaskImageFilterTest(int argc, char * argv[])
9898
{
9999
if (argc < 4)
100100
{
101-
std::cerr << "Usage:\n itkUnsharpMaskImageFilterTest";
101+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
102102
std::cerr << " float | uchar in.png out.nrrd [amount [sigma [threshold]]]" << std::endl;
103103
return EXIT_FAILURE;
104104
}

Modules/Filtering/ImageGradient/test/itkGradientRecursiveGaussianFilterSpeedTest.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
*=========================================================================*/
1818

1919
#include "itkGradientRecursiveGaussianImageFilter.h"
20+
#include "itkTestingMacros.h"
2021

2122

2223
int
2324
itkGradientRecursiveGaussianFilterSpeedTest(int argc, char * argv[])
2425
{
2526
if (argc != 3)
2627
{
27-
std::cerr << "usage: size reps" << std::endl;
28+
std::cerr << "usage: " << itkNameOfTestExecutableMacro(argv) << " size reps" << std::endl;
2829
return EXIT_FAILURE;
2930
}
3031

Modules/Filtering/ImageGrid/test/itkMirrorPadImageFilterTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ itkMirrorPadImageFilterTest(int argc, char * argv[])
7878
{
7979
if (argc < 4)
8080
{
81-
std::cerr << "Usage:\n itkMirrorPadImageFilterTest";
81+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
8282
std::cerr << " float | uchar in.png out.nrrd [decayFactor [lowerPad [upperPad]]]" << std::endl;
8383
return EXIT_FAILURE;
8484
}

Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
#include "itkQuadEdgeMeshExtendedTraits.h"
2323
#include "itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h"
24+
#include "itkTestingMacros.h"
2425

2526
int
2627
itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest(int argc, char * argv[])
2728
{
2829
if (argc < 2)
2930
{
30-
std::cout << "*** GaussianCurvature ***" << std::endl;
31-
std::cout << "This example requires at least one argument:" << std::endl;
32-
std::cout << " 1- FileName" << std::endl;
31+
std::cerr << "Missing parameters." << std::endl;
32+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " inputFileName" << std::endl;
3333
return EXIT_FAILURE;
3434
}
3535

Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteMaximumCurvatureQuadEdgeMeshFilterTest.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
#include "itkQuadEdgeMeshExtendedTraits.h"
2222
#include "itkDiscreteMaximumCurvatureQuadEdgeMeshFilter.h"
23+
#include "itkTestingMacros.h"
2324

2425
int
2526
itkDiscreteMaximumCurvatureQuadEdgeMeshFilterTest(int argc, char * argv[])
2627
{
2728
if (argc < 2)
2829
{
29-
std::cout << "*** GaussianCurvature ***" << std::endl;
30-
std::cout << "This example requires at least one argument:" << std::endl;
31-
std::cout << " 1- FileName" << std::endl;
30+
std::cerr << "Missing parameters." << std::endl;
31+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " inputFileName" << std::endl;
3232
return EXIT_FAILURE;
3333
}
3434

Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteMeanCurvatureQuadEdgeMeshFilterTest.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
#include "itkQuadEdgeMeshExtendedTraits.h"
2222
#include "itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h"
23+
#include "itkTestingMacros.h"
2324

2425
int
2526
itkDiscreteMeanCurvatureQuadEdgeMeshFilterTest(int argc, char * argv[])
2627
{
2728
if (argc < 2)
2829
{
29-
std::cout << "*** GaussianCurvature ***" << std::endl;
30-
std::cout << "This example requires at least one argument:" << std::endl;
31-
std::cout << " 1- FileName" << std::endl;
30+
std::cerr << "Missing parameters." << std::endl;
31+
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " inputFileName" << std::endl;
3232
return EXIT_FAILURE;
3333
}
3434

0 commit comments

Comments
 (0)