Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Increase coverage for miscellaneous classes #4166

Conversation

jhlegarreta
Copy link
Member

Increase coverage for miscellaneous classes:

  • Exercise basic object methods using the ITK_EXERCISE_BASIC_OBJECT_METHODS macro.
  • Test the boolean ivars using the ITK_TEST_SET_GET_BOOLEAN macro.
  • Use other testing macros as necessary to check for expected values.
  • Test the exceptions using the ITK_TRY_EXPECT_EXCEPTION.
  • Explicitly call the Print method when some ivars (e.g. containers of some kind) need to have some data so that the corresponding serialization statements in the PrintSelf method can be called. Call these methods once the instance data has been set and the filter has been updated.

PR Checklist

@github-actions github-actions bot added 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:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Coverage Code coverage impacts area:Numerics Issues affecting the Numerics module labels Aug 22, 2023
@jhlegarreta jhlegarreta force-pushed the IncreaseMiscClassesCoverage19 branch 2 times, most recently from 7a7208b to af8701f Compare August 23, 2023 01:46
Copy link
Member

@dzenanz dzenanz left a comment

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.

@vfonov
Copy link
Contributor

vfonov commented Aug 23, 2023

seem to be ok

Increase coverage for miscellaneous classes:
- Exercise basic object methods using the
  `ITK_EXERCISE_BASIC_OBJECT_METHODS` macro.
- Test the boolean ivars using the `ITK_TEST_SET_GET_BOOLEAN` macro.
- Use other testing macros as necessary to check for expected values.
- Test the exceptions using the `ITK_TRY_EXPECT_EXCEPTION`.
- Explicitly call the `Print` method when some ivars (e.g. containers of
  some kind) need to have some data so that the corresponding
  serialization statements in the `PrintSelf` method can be called. Call
  these methods once the instance data has been set and the filter has
  been updated.
@jhlegarreta jhlegarreta marked this pull request as ready for review August 27, 2023 23:29
@jhlegarreta
Copy link
Member Author

jhlegarreta commented Aug 27, 2023

Note that tests may pass even if compilation errors occur or checks do not pass in itkMINCTransformAdapterTest.cxx because the IOTransformMINC module is not activated by default.

using TransformAdapterTypeExcp44 =
itk::MINCTransformAdapter<ParametersValueType, InputDimensionExcp4, OutputDimensionExcp4>;

ITK_TRY_EXPECT_EXCEPTION(TransformAdapterTypeExcp44::New());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above three cases should ideally be done with a Cartesian product, but the template requires compile time constants. Maybe future versions of C++ will allow doing a constexpr auto prod = CartesianProduct() (?)

@jhlegarreta
Copy link
Member Author

jhlegarreta commented Aug 28, 2023

Compiles fine locally (Win 10; MSVC 2022); the test is segfaulting for other reasons: cross-referencing #4175 (comment)

All new checks added in this patch set pass for itkMINCTransformAdapterTest, the segfault happening at a later stage.

@dzenanz dzenanz merged commit fd873b7 into InsightSoftwareConsortium:master Aug 30, 2023
5 checks passed
@jhlegarreta jhlegarreta deleted the IncreaseMiscClassesCoverage19 branch August 30, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Coverage Code coverage impacts 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants