From d786f75baa8b0ba0df88781b3f84ca84512394db Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 16 Dec 2024 11:25:33 -0600 Subject: [PATCH] COMP: Add test to avoid unused variable warning Making variables const identified that the requestedRegion was an unused variable. Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx:82:31: warning: unused variable 'requestedRegion' [-Wunused-variable] Expanded the testing to ensure that all 3 cropped regions are updated to the same size & index values. --- .../ImageGrid/test/itkCropImageFilterTest.cxx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx index 5e459f887b8..4a6a3ac77cc 100644 --- a/Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx @@ -79,18 +79,22 @@ itkCropImageFilterTest(int, char *[]) cropFilter->UpdateLargestPossibleRegion(); + // Test all the region types from a CropImageFilter const ImageType::RegionType requestedRegion = cropFilter->GetOutput()->GetRequestedRegion(); + const ImageType::RegionType bufferedRegion = cropFilter->GetOutput()->GetBufferedRegion(); + const ImageType::RegionType largestRegion = cropFilter->GetOutput()->GetLargestPossibleRegion(); - if (cropFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0] != 6 || - cropFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1] != 10) + for (auto & currRegion : { requestedRegion, bufferedRegion, largestRegion }) { - return EXIT_FAILURE; - } - - if (cropFilter->GetOutput()->GetLargestPossibleRegion().GetIndex()[0] != 1 || - cropFilter->GetOutput()->GetLargestPossibleRegion().GetIndex()[1] != 1) - { - return EXIT_FAILURE; + if (currRegion.GetSize()[0] != 6 || currRegion.GetSize()[1] != 10) + { + return EXIT_FAILURE; + } + + if (currRegion.GetIndex()[0] != 1 || currRegion.GetIndex()[1] != 1) + { + return EXIT_FAILURE; + } } return EXIT_SUCCESS;