From 3887bee4984471cf569c4a2b66afbb1fb18d33b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Wed, 8 Jun 2022 17:45:08 -0400 Subject: [PATCH] STYLE: Increase test style consistency Increase test style consistency: - Check the test input arguments at the beginning to conform to the ITK SW Guide style guidelines. Take advantage of the commit to make the argument check message consistent with the ITK SW Guide style guidelines. - Prefer using `constexpr ` to define compile-time constant values. --- ...esolutionPDEDeformableRegistrationTest.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Modules/Registration/PDEDeformable/test/itkMultiResolutionPDEDeformableRegistrationTest.cxx b/Modules/Registration/PDEDeformable/test/itkMultiResolutionPDEDeformableRegistrationTest.cxx index 77faec011ee..b55d6ca1c0e 100644 --- a/Modules/Registration/PDEDeformable/test/itkMultiResolutionPDEDeformableRegistrationTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkMultiResolutionPDEDeformableRegistrationTest.cxx @@ -140,11 +140,16 @@ int itkMultiResolutionPDEDeformableRegistrationTest(int argc, char * argv[]) { - using PixelType = unsigned char; - enum + if (argc < 2) { - ImageDimension = 2 - }; + std::cerr << "Missing parametes." << std::endl; + std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " WarpedImage" << std::endl; + return EXIT_FAILURE; + } + + constexpr unsigned int ImageDimension = 2; + using PixelType = unsigned char; + using ImageType = itk::Image; using VectorType = itk::Vector; using FieldType = itk::Image; @@ -152,12 +157,6 @@ itkMultiResolutionPDEDeformableRegistrationTest(int argc, char * argv[]) using SizeType = ImageType::SizeType; using RegionType = ImageType::RegionType; - if (argc < 2) - { - std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " WarpedImage\n"; - return EXIT_FAILURE; - } - //-------------------------------------------------------- std::cout << "Generate input images and initial field"; std::cout << std::endl;