Skip to content

Extend the use of some testing macros to examples #1275

@jhlegarreta

Description

@jhlegarreta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:Use_Milestone_BacklogUse "Backlog" milestone instead of label for issues without a fixed deadlinetype:DesignImprovement in the design of a given area

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions