Skip to content

ENH: Convert 4 no-argument CTests to GoogleTest#6045

Merged
hjmjohnson merged 8 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:convert-4-tests-to-gtest
Apr 13, 2026
Merged

ENH: Convert 4 no-argument CTests to GoogleTest#6045
hjmjohnson merged 8 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:convert-4-tests-to-gtest

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Convert 4 no-argument legacy CTests to GoogleTest from 4 different module directories. Each test uses a two-commit pattern: git mv rename (preserves git log --follow history) then content conversion + CMakeLists.txt update.

  • itkNthElementPixelAccessorTest → Core/ImageAdaptors
  • itkVarianceImageFunctionTest → Core/ImageFunction
  • itkTensorRelativeAnisotropyImageFilterTest → Filtering/DiffusionTensorImage (new GTest driver)
  • itkChiSquareDistributionTest → Numerics/Statistics (new GTest driver, split into 7 TEST() blocks)

All 11 tests build and pass locally (LLVM 22, macOS arm64).

Conversion details

History preservation: Each conversion starts with a pure git mv commit (100% rename similarity) so git log --follow itkFooGTest.cxx traces back through the original test's full history.

New GTest infrastructure added to DiffusionTensorImage and Statistics modules (set(*GTests ...) + creategoogletestdriver()).

ChiSquareDistribution split into 7 TEST() blocks matching the original's logical sections: BasicObjectProperties, CDF at 1/11/100 dof, ParameterVectorAPI, SeparateParameterAPI, WrongParametersThrow, SetGetDegreesOfFreedom. Repeated CDF/inverse verification extracted into VerifyCDF()/VerifyInverseCDF() helpers. ITK_TRY_EXPECT_EXCEPTIONEXPECT_THROW.

NthElementPixelAccessor now asserts all 3 vector components (not just index 0).

CMake source lists kept alphabetically sorted per project convention.

@github-actions github-actions bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation area:Python wrapping Python bindings for a class type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:Numerics Issues affecting the Numerics module labels Apr 13, 2026
@hjmjohnson hjmjohnson force-pushed the convert-4-tests-to-gtest branch 2 times, most recently from 5429771 to 85759ac Compare April 13, 2026 01:23
@hjmjohnson hjmjohnson force-pushed the convert-4-tests-to-gtest branch from 85759ac to ce5792c Compare April 13, 2026 01:30
@hjmjohnson hjmjohnson marked this pull request as ready for review April 13, 2026 10:58
@greptile-apps

This comment was marked as resolved.

Comment thread Modules/Numerics/Statistics/test/itkChiSquareDistributionGTest.cxx Outdated
@hjmjohnson hjmjohnson force-pushed the convert-4-tests-to-gtest branch from ce5792c to 88deb32 Compare April 13, 2026 11:34
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

@hjmjohnson hjmjohnson merged commit 9e00915 into InsightSoftwareConsortium:main Apr 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:Numerics Issues affecting the Numerics module area:Python wrapping Python bindings for a class type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants