Skip to content

ENH: Convert six no-arg ImageIntensity tests to GoogleTest#6143

Merged
dzenanz merged 6 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:convert-filter-gtests-2026-04-25
Apr 27, 2026
Merged

ENH: Convert six no-arg ImageIntensity tests to GoogleTest#6143
dzenanz merged 6 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:convert-filter-gtests-2026-04-25

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Mechanical CTest → GoogleTest conversion of the six alphabetically-first no-argument tests under `Modules/Filtering/ImageIntensity/test/`. Same pattern as #6071 and #6132. All six pass against `ITKImageIntensityGTestDriver` locally.

Conversions
# Old New
1 `itkAbsImageFilterAndAdaptorTest` `itkAbsImageFilterAndAdaptorGTest`
2 `itkAcosImageFilterAndAdaptorTest` `itkAcosImageFilterAndAdaptorGTest`
3 `itkAdaptImageFilterTest` `itkAdaptImageFilterGTest`
4 `itkAdaptImageFilterTest2` `itkAdaptImageFilterGTest2`
5 `itkAddImageAdaptorTest` `itkAddImageAdaptorGTest`
6 `itkAddImageFilterFrameTest` `itkAddImageFilterFrameGTest`

Each conversion is a single `git mv`-tracked rename + body edit + `CMakeLists.txt` update — `git log --follow` keeps the pre-conversion history. CMake source-list entries kept alphabetically sorted in both `ITKImageIntensityTests` (legacy) and `ITKImageIntensityGTests`.

Mechanical-conversion details
  • `int itkFooTest(int, char *[])` → `TEST(Foo, ConvertedLegacyTest)`.
  • `if (...) return EXIT_FAILURE` → `EXPECT_*` (or `EXPECT_THROW` for the three exception cases in `AddImageFilterFrame`).
  • `ITK_EXERCISE_BASIC_OBJECT_METHODS` → `ITK_GTEST_EXERCISE_BASIC_OBJECT_METHODS` (avoids the `return EXIT_FAILURE` path that breaks under MSVC inside a void TEST body — same gotcha as ENH: Convert four no-arg Common tests to GoogleTest #6132).
  • `itk::Math::FloatAlmostEqual(a, b, 10, eps)` → `EXPECT_NEAR(a, b, eps)`.
  • `itk::Math::NotExactlyEquals(a, b)` predicate flips → `EXPECT_EQ(a, b)`.
  • Removed redundant `std::cout`-only diagnostics on the success path; preserved scope-explaining comments.
  • Helper typedefs hoisted into anonymous `namespace { }` where they were file-scope in the original.
Local verification

```
[----------] Global test environment tear-down
[==========] 11 tests from 8 test suites ran. (1 ms total)
[ PASSED ] 11 tests.
```

Filter: full `ITKImageIntensityGTestDriver` (no `--gtest_filter`). All converted tests run; pre-existing `ArithmeticOpsTest` and `BitwiseOpsTest` GTests still pass.

@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 type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module labels Apr 26, 2026
@hjmjohnson hjmjohnson marked this pull request as ready for review April 26, 2026 12:06
@greptile-apps

This comment was marked as resolved.

@hjmjohnson hjmjohnson requested a review from dzenanz April 27, 2026 11:40
@dzenanz dzenanz merged commit c44c3a2 into InsightSoftwareConsortium:main Apr 27, 2026
16 checks passed
@hjmjohnson hjmjohnson added this to the ITK 6.0.0 milestone May 5, 2026
hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module 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