-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add tests for printf.jl #15377
Add tests for printf.jl #15377
Conversation
makes sense to me |
#14410 might be relevant. I apologize for not seeing this earlier. |
It's okay. I think the author of that PR changed his mind about wanting to contribute, but if you'd like to take what he started with, rebase and clean it up for re-submission that would be welcome. |
I'd like to do that. Thank you! |
I added the tests, based on those in #14410. |
I figured out the problem: @sprintf("%p",42)
# returns 0x000000000000002a in a 64 bit system which is 64 bits, but in a 32 bit system, it will return a 32 bit hex code. So, the tests will fail. I checked the tests on integers and removed all tests that presumed 64 bits. But I need some help for floats. @tkelman Can you tell me what I should do to check that? Thank you! |
Floats don't depend on system word size so those should be safe to leave unconditional. Like @tkelman suggested, the simplest way to fix the tests on 32-bit is to make the value you compare against conditionl on |
("%-20a","0x2.ap+4 "), | ||
("%f", "42.000000"), | ||
("%g", "42")), | ||
num in (UInt16(42), UInt32(42), UInt64(42), UInt128(42), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is num
getting used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was supposed to be added in Line 30 (instead of 42
). I'll add it now!
I have added a few more tests (two, to be exact) which were not covered earlier. I can rebase all the commits in this pull request into one commit before merging. Also, is there anything else I should do? Thank you! |
Nevermind my most recent comment which I deleted, I see there was a duplicated line in the existing test. I think all this needs is a squash, nice work! |
@tkelman I squashed all the commits. Can you check if everything's alright? |
Thanks! |
Since the error has to deal with the number of arguments, ArgumentError is more apt.
Also, in the same file, a similar statement (on Line 1167) is present: