Repository navigation
BUG: Fail metric tests whose expected exception is not thrown, then convert to GoogleTest - #7052
Merged
hjmjohnson merged 4 commits intoNov 2, 2026
Conversation
3 of 11 tasks
hjmjohnson
marked this pull request as ready for review
October 31, 2026 18:23
Contributor
[Low impact] The PR changes how two Registration Common tests report their results. The PR appears safe to merge, with a non-blocking improvement to make the small-deviation exception check repeatable. Findings
|
The checks that an exception is thrown printed a value when nothing was thrown but did not fail the test.
hjmjohnson
force-pushed
the
bug-metric-expected-exceptions
branch
from
October 31, 2026 23:23
ad4a138 to
81fa904
Compare
…hrown The check that an exception is thrown printed a value when nothing was thrown but did not fail the test.
Converts itkKullbackLeiblerCompareHistogramImageToImageMetricTest.
hjmjohnson
force-pushed
the
bug-metric-expected-exceptions
branch
from
November 1, 2026 00:52
81fa904 to
1824982
Compare
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 1, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 1, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 2, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Registration metric tests tried to cause an exception, but when nothing was thrown they printed the metric value and still passed. For each test, one
BUG:commit makes the check fail, and the next commit converts the fixed test to GoogleTest (EXPECT_THROW).itkMutualInformationMetricTestitkKullbackLeiblerCompareHistogramImageToImageMetricTestTesting
macOS arm64, conda clang, Release,
ITK_BUILD_DEFAULT_MODULES=OFF,Module_ITKRegistrationCommon=ON. Every one of the 4 commits builds both RegistrationCommon drivers with 0 warnings and passes the two tests. Each fixed legacy test passes, which confirms that all three calls do throw, including the standard-deviation case (the KullbackLeibler test has that block commented out).pre-commit run --all-filespasses.EXPECT_THROWkeeps both original statements,Initialize()andGetValue(), since either may be the one that throws.How these were found
Same review as #7046, extended to the rest of the tree. The staged conversions on
gtest-staging-Ccopied these blocks faithfully.AI assistance (Claude Code) was used to find the defects and draft the changes; they were reviewed and tested locally.