-
-
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
Added tests for math.jl functions #9568
Conversation
Hi, good idea, I think. (An alternative would be to test every function that excessively... Maybe in 0.5 or so... :-p ) |
It was mentioned elsewhere that edit- found the comment #8364 (comment) |
Oops ... I should have read the output of |
If the tests of mod2pi that you're adding cover areas that the existing ones don't, then I'd say add them to the other file. On special functions, most of the |
Looking at the |
Sure. |
Did I screw up the git log again? Twice in one day? |
Nope, 0542cb1 looks fine. Sometimes you need to refresh the page, or github can get confused for a second. For anyone else's reference the original commit that included mod2pi tests (now rebased away) was abd6908. Not sure whether everyone's 100% on the same page when it comes to code style for whitespace-inside-parens / brackets, but that's functionally irrelevant. I think the encouraging readable whitespace item in CONTRIBUTING.md is mostly about whitespace after commas, but I could be wrong on that. |
#9544 would be the culprit there (maybe?), we'll probably turn off the |
|
||
# modf | ||
for elty in (Float32, Float64) | ||
@test_approx_eq modf( convert(elty,1.2) )[1] convert(elty,0.2) |
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.
I guess one slightly more concise syntax for testing approximate equality of a tuple-returning function would be by splatting into an array like @test_approx_eq [modf(convert(elty,1.2))...] elty[0.2, 1.0]
. There's more syntax features going on there so maybe that's unnecessarily complicated.
Since the travis failure has nothing to do with this PR, I'm going to merge. |
Added tests for math.jl functions
backported the new tests in f4bd89f |
mod2pi
andmodf
had no tests at all so I added enough that all branches are covered. There might be one or two extraneous ones.frexp
had one test but most of the function (the array version, theFloat32
andFloat64
specializations) was not covered so I added tests for that as well.@test_approx_eq
didn't seem to want to work with tuples - if there's a way to do this I can change themodf
andfrexp
tests to be more concise.