Description
Derived from this PR to fix a bug it would may be useful to be able to use the ITK_TRY_EXPECT_NO_EXCEPTION macro also in the ITK Examples.
The macro is currently defined in itkTestingMacros.h, and is virtually never used in the ITK code base or Examples because may be including [itkTestingMacros.h] in such files is counter-intuitive indeed.
So may be it should be moved to elsewhere, since in reality, try/catch blocks are not really limited to tests and examples.
It would avoid writing boilerplate code, and making the exception messages consistent.
Impact analysis
It would allow to avoid bugs such as the one mentioned, would make the code more consistent, have less boilerplate code, and no downsides to it can are foreseen.
Expected behavior
Be able to call
ITK_TRY_EXPECT_NO_EXCEPTION( filter->Update() );
macros from the ITK code base or Examples including some header file other than itkTestingMacros.h, which seems counter-intuitive.
Actual behavior
The ITK_TRY_EXPECT_NO_EXCEPTION macros is virtually never used in the ITK code base or the Examples.
Versions
master
Additional Information
One may wonder what to do with TRY_EXPECT_EXCEPTION then, since that is really intended for tests.
Naming may need to be taken care of. Almost all macros in itkTestingMacros have the prefix TEST. And a few do not.
Related to #1273.
Description
Derived from this PR to fix a bug it would may be useful to be able to use the
ITK_TRY_EXPECT_NO_EXCEPTIONmacro also in the ITK Examples.The macro is currently defined in
itkTestingMacros.h, and is virtually never used in the ITK code base or Examples because may be including [itkTestingMacros.h] in such files is counter-intuitive indeed.So may be it should be moved to elsewhere, since in reality,
try/catchblocks are not really limited to tests and examples.It would avoid writing boilerplate code, and making the exception messages consistent.
Impact analysis
It would allow to avoid bugs such as the one mentioned, would make the code more consistent, have less boilerplate code, and no downsides to it can are foreseen.
Expected behavior
Be able to call
macros from the ITK code base or Examples including some header file other than
itkTestingMacros.h, which seems counter-intuitive.Actual behavior
The
ITK_TRY_EXPECT_NO_EXCEPTIONmacros is virtually never used in the ITK code base or the Examples.Versions
masterAdditional Information
One may wonder what to do with
TRY_EXPECT_EXCEPTIONthen, since that is really intended for tests.Naming may need to be taken care of. Almost all macros in itkTestingMacros have the prefix
TEST. And a few do not.Related to #1273.