-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
NumberToStringGTest: add #include, avoid narrowing conversion pow, mention floating point type on an expect failure #3751
Merged
dzenanz
merged 2 commits into
InsightSoftwareConsortium:master
from
N-Dekker:Add-missing-include-cmath
Nov 29, 2022
Merged
NumberToStringGTest: add #include, avoid narrowing conversion pow, mention floating point type on an expect failure #3751
dzenanz
merged 2 commits into
InsightSoftwareConsortium:master
from
N-Dekker:Add-missing-include-cmath
Nov 29, 2022
Conversation
This file contains 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
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
Nov 17, 2022
Open
dzenanz
approved these changes
Nov 17, 2022
This PR does not resolve the failure.
|
Added `#include <cmath>`, to ensure that all `std::pow` overloads are included. Explicitly declared the local `power_of_ten` variables as `TValue` and prevented a narrowing conversion from those `std::pow` calls, just to be sure.
Aims to ease the analysis of NumberToStringGTest test failures, like the `NumberToString.DecimalNotationUpTo21Digits` failures reported by yurivict at InsightSoftwareConsortium#3739 saying: /disk-samsung/freebsd-ports/science/InsightToolkit/work/ITK-5.2.1/Modules/Core/Common/test/itkNumberToStringGTest.cxx:87: Failure Expected equality of these values: numberToString(power_of_ten) Which is: "100000010000" '1' + std::string(exponent, '0') Which is: "100000000000"
N-Dekker
force-pushed
the
Add-missing-include-cmath
branch
from
November 20, 2022 10:31
2031457
to
d5c4fd2
Compare
N-Dekker
changed the title
BUG: Fix NumberToStringGTest failures by adding missing #include <cmath>
NumberToStringGTest: add #include, avoid narrowing conversion pow, mention floating point type on an expect failure
Nov 20, 2022
Thanks @yurivict I removed the claim that this PR would fix those But I also added an extra commit, with should make the test failures slightly more informative, by mentioning the floating point type ("float" or "double") with each expectation failure. Can you please try that out as well? |
dzenanz
approved these changes
Nov 21, 2022
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
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.
A few small improvements of NumberToStringGTest, triggered by the
NumberToString.DecimalNotationUpTo21Digits
failures reported by @yurivict at issue #3739 saying: