Skip to content

Commit

Permalink
STYLE: Do not Fill empty local variables in itkMeshIOTestHelper.h
Browse files Browse the repository at this point in the history
An instance of `itk::Array`, `itk::VariableLengthVector`, or
`itk::VariableSizeMatrix` is empty, when it is just default-constructed. An
attempt to `Fill` such an empty object has no effect.

- Follow-up to pull request InsightSoftwareConsortium#4898
"Do not `Fill` default-constructed empty local variables in tests"
  • Loading branch information
N-Dekker committed Oct 26, 2024
1 parent 0883d0c commit 8e482dc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Modules/IO/MeshBase/include/itkMeshIOTestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using ArrayPixelType = itk::Array<FloatType>;

ArrayPixelType arrayPixelValue;
arrayPixelValue.Fill(1.0);
ArrayPixelType arrayPixelValue{};
usePointPixel = true;
meshIO->SetPixelType(arrayPixelValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(arrayPixelValue.Size(), meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -269,8 +268,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using VariableLengthVectorPixelType = itk::VariableLengthVector<FloatType>;

VariableLengthVectorPixelType variableLengthVectorValue;
variableLengthVectorValue.Fill(1.0);
VariableLengthVectorPixelType variableLengthVectorValue{};
usePointPixel = true;
meshIO->SetPixelType(variableLengthVectorValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(variableLengthVectorValue.Size(), meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -288,8 +286,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using VariableSizeMatrixType = itk::VariableSizeMatrix<FloatType>;

VariableSizeMatrixType matrix;
matrix.Fill(1.0);
VariableSizeMatrixType matrix{};
usePointPixel = true;
meshIO->SetPixelType(matrix, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(matrix.Rows() * matrix.Cols(), meshIO->GetNumberOfPointPixelComponents());
Expand Down

0 comments on commit 8e482dc

Please sign in to comment.