Skip to content

Commit f36cd56

Browse files
committed
STYLE: Replace Fill(T{}) w/ {} initializer for local variables in tests
Replaced code of the form Type var; var.Fill(ElementType{}); with `Type var{};` Using Notepad++, Replace in Files, doing: Find what: ^([ ]+ [^ ].*[ ])(\w+);[\r\n]+ [ ]+\2\.Fill\(.+{}\); Replace with: $1$2{}; Filters: itk*Test*.cxx [v] Match case (*) Regular expression Follow-up to pull request InsightSoftwareConsortium#4881 commit 569a8b6 "STYLE: Replace Fill(0) with {} initializer for local variables in tests"
1 parent d36dfc6 commit f36cd56

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

Modules/Filtering/ImageFusion/test/itkLabelToRGBImageFilterTest.cxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ itkLabelToRGBImageFilterTest(int argc, char * argv[])
6060
filter->SetBackgroundValue(backgroundValue);
6161
ITK_TEST_SET_GET_VALUE(backgroundValue, filter->GetBackgroundValue());
6262

63-
typename FilterType::OutputPixelType backgroundColor;
64-
backgroundColor.Fill(typename FilterType::OutputPixelValueType{});
63+
typename FilterType::OutputPixelType backgroundColor{};
6564
filter->SetBackgroundColor(backgroundColor);
6665
ITK_TEST_SET_GET_VALUE(backgroundColor, filter->GetBackgroundColor());
6766

Modules/IO/HDF5/test/itkHDF5ImageIOTest.cxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,7 @@ HDF5ReadWriteTest(const char * fileName)
271271
success = EXIT_FAILURE;
272272
}
273273

274-
itk::Array<char> metaDataCharArray2;
275-
metaDataCharArray2.Fill(char{});
274+
itk::Array<char> metaDataCharArray2{};
276275
if (!itk::ExposeMetaData<itk::Array<char>>(metaDict2, "TestCharArray", metaDataCharArray2) ||
277276
metaDataCharArray2 != metaDataCharArray)
278277
{

Modules/Registration/Metricsv4/test/itkImageToImageMetricv4RegistrationTest.cxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ ImageToImageMetricv4RegistrationTestRun(typename TMetric::Pointer metric,
6767
typename TImage::SpacingType spacing;
6868
spacing.Fill(itk::NumericTraits<CoordinateRepresentationType>::OneValue());
6969

70-
typename TImage::PointType origin;
71-
origin.Fill(CoordinateRepresentationType{});
70+
typename TImage::PointType origin{};
7271

7372
typename TImage::DirectionType direction;
7473
direction.Fill(itk::NumericTraits<CoordinateRepresentationType>::OneValue());

Modules/Registration/Metricsv4/test/itkObjectToObjectMultiMetricv4RegistrationTest.cxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ ObjectToObjectMultiMetricv4RegistrationTestCreateImages(typename TImage::Pointer
9595
typename TImage::SpacingType spacing;
9696
spacing.Fill(itk::NumericTraits<CoordinateRepresentationType>::OneValue());
9797

98-
typename TImage::PointType origin;
99-
origin.Fill(CoordinateRepresentationType{});
98+
typename TImage::PointType origin{};
10099

101100
typename TImage::DirectionType direction;
102101
direction.Fill(itk::NumericTraits<CoordinateRepresentationType>::OneValue());

0 commit comments

Comments
 (0)