Skip to content

ENH: Convert itkBinaryThresholdImageFilterTest to GoogleTest - #7040

Merged
hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-binary-threshold-gtest
Oct 30, 2026
Merged

hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-binary-threshold-gtest

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Converts itkBinaryThresholdImageFilterTest to GoogleTest, as @blowekamp suggested in the #7008 review: the hand-written check, print, and return blocks become one EXPECT_EQ each, so a wrong comparison like the one #7008 fixes is visible at a glance.

#7008 has merged; this branch is two commits on main: a pure rename, then the conversion.

Reference: the bulk GoogleTest conversions

This follows the pattern of the earlier no-argument CTest conversions already merged, for example #5874, #6045, #6071, #6132, #6143, #6177, #6197, #6200, #6246, and #6369: rename in one commit so history follows the file, then convert the test body and register it with the module's GoogleTest driver.

The remaining no-argument CTests are converted on staging branches, one commit per test, for review in small batches: gtest-staging-A for Core and IO modules, gtest-staging-B for Filtering modules, and gtest-staging-C for Numerics and Registration modules, on hjmjohnson/ITK. This test came from gtest-staging-B, and that branch now carries this exact version.

Testing

macOS arm64, minimal build with Module_ITKThresholding=ON, testing on: 0 warnings; BinaryThresholdImageFilter.ConvertedLegacyTest passes, and all 72 ITKThresholding tests pass. pre-commit run --all-files passes.

@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 Oct 30, 2026
Rename the file in its own commit so that git history follows it into
the GoogleTest version; the test is dropped from the CTest driver here
and registered with the GoogleTest driver in the next commit.
@hjmjohnson
hjmjohnson force-pushed the enh-binary-threshold-gtest branch from 1d797fe to 6e64277 Compare October 30, 2026 15:13
@hjmjohnson
hjmjohnson requested a review from blowekamp October 30, 2026 15:15
@hjmjohnson
hjmjohnson marked this pull request as ready for review October 30, 2026 15:15
@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes affect one module's test setup, not filter behavior at runtime.

The PR appears safe to merge, with a non-blocking improvement to stop pixel checks after a failed update.

Findings

  1. P2 Test reads unfinished output ▶

Summary

Converts itkBinaryThresholdImageFilterTest to GoogleTest.

  • The binary-threshold test now runs as a GoogleTest case.

Reviews (1) · Last reviewed commit: "ENH: Convert itkBinaryThresholdImageFilt..." · Reviewed by Greptile

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

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.

The hand-written check, print, and return blocks made a wrong default
check easy to miss (the upper threshold was compared against the lower
threshold default). EXPECT_EQ states each check in one line and reports
both values on failure.
@hjmjohnson
hjmjohnson force-pushed the enh-binary-threshold-gtest branch from 6e64277 to b627128 Compare October 30, 2026 20:48
@hjmjohnson
hjmjohnson merged commit d403b90 into InsightSoftwareConsortium:main Oct 30, 2026
14 of 16 checks passed
@hjmjohnson
hjmjohnson deleted the enh-binary-threshold-gtest branch October 30, 2026 20:59
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