Skip to content

Commit

Permalink
STYLE: Make variable for magic number
Browse files Browse the repository at this point in the history
The number really does not matter, but make a variable
to indicate where it needs to be consistent in the test.
  • Loading branch information
hjmjohnson committed Apr 30, 2024
1 parent 1540fa4 commit fbe68ab
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,13 @@ TEST(ShapedImageNeighborhoodRange, CanBeUsedAsExpressionOfRangeBasedForLoop)
const itk::Size<ImageType::ImageDimension> radius = { { 0, 1 } };
const std::vector<itk::Offset<ImageType::ImageDimension>> offsets =
itk::GenerateRectangularImageNeighborhoodOffsets(radius);
RangeType range{ *image, location, offsets };
RangeType range{ *image, location, offsets };
constexpr PixelType reference_value = 42;

for (const PixelType pixel : range)
{
EXPECT_NE(pixel, 42);
// Initially not set to reference value
EXPECT_NE(pixel, reference_value);
}

// Note: instead of 'iterator::reference', you may also type 'auto&&', but
Expand All @@ -474,12 +476,12 @@ TEST(ShapedImageNeighborhoodRange, CanBeUsedAsExpressionOfRangeBasedForLoop)
// https://bugs.llvm.org/show_bug.cgi?id=37392
for (RangeType::iterator::reference pixel : range)
{
pixel = 42;
pixel = reference_value;
}

for (const PixelType pixel : range)
{
EXPECT_EQ(pixel, 42);
EXPECT_EQ(pixel, reference_value);
}
}

Expand Down

0 comments on commit fbe68ab

Please sign in to comment.