Skip to content

Commit

Permalink
COMP: Adding test for CreateWithMatrixAndOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson committed Jun 18, 2024
1 parent 76b8647 commit a81ea1e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Modules/Core/Transform/test/itkMatrixOffsetTransformBaseGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,31 @@ TEST(MatrixOffsetTransformBase, SetFixedParametersThrowsWhenSizeIsLessThanNDimen
Assert_SetFixedParameters_throws_when_size_is_less_than_NDimensions<3>();
Assert_SetFixedParameters_throws_when_size_is_less_than_NDimensions<4>();
}

// Check that fixed parameters are set to default values during construction.
TEST(MatrixOffsetTransformBase, CreateWithMatrixAndOffset)
{
class DerivedTransform : public itk::MatrixOffsetTransformBase<>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(DerivedTransform);

static auto
Create()
{
// Indirectly call the `MatrixOffsetTransformBase(const MatrixType &, const OutputVectorType &)` constructor.
const itk::SmartPointer<DerivedTransform> ptr = new DerivedTransform(MatrixType(), OutputVectorType());
ptr->UnRegister();
return ptr;
}

private:
// Inherit the constructors of MatrixOffsetTransformBase:
using itk::MatrixOffsetTransformBase<>::MatrixOffsetTransformBase;
};

const auto transform = DerivedTransform::Create();
const DerivedTransform::FixedParametersType expectedFixedParameters(DerivedTransform::InputSpaceDimension, 0);

EXPECT_EQ(transform->GetFixedParameters(), expectedFixedParameters);
}

0 comments on commit a81ea1e

Please sign in to comment.