Skip to content

Commit

Permalink
COMP: Add test to avoid unused variable warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hjmjohnson committed Dec 16, 2024
1 parent 1a9bd4a commit d786f75
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d786f75

Please sign in to comment.