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

BUG: fix uninitialized memory warning in PeriodicBoundaryCondition test #2841

Conversation

blowekamp
Copy link
Member

The image buffer needs to be filled with values before usage. Also,
convert a print statement to a check for an expected value.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

The image buffer needs to be filled with values before usage. Also,
convert a print statement to a check for an expected value.
@github-actions github-actions bot added area:Core Issues affecting the Core module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct labels Oct 27, 2021
@seanm
Copy link
Contributor

seanm commented Oct 27, 2021

thx @blowekamp this is much better.

@@ -312,7 +314,7 @@ itkPeriodicBoundaryConditionTest(int, char *[])
}
++testIter;
}
std::cout << "Dummy sum: " << sum << std::endl;
ITK_TEST_EXPECT_EQUAL(sum, testSize[0] * testSize[1] * 3);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does the number 3 come from? Maybe you could use back.size() instead...?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, that would be further improvement. I miss some of the details with that new fangled for new, when I made the change. I think this is better than a plain 12288 number it should be OK.

Copy link
Contributor

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

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

@blowekamp Approved, of course, but please consider my comment to avoid the "magic number" 3: #2841 (comment)

@blowekamp blowekamp merged commit da1908e into InsightSoftwareConsortium:master Oct 27, 2021
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 type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances 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.

6 participants