-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix argmax, findmax, findXwithfirst, and expand testing #99
Conversation
Ah yes, the inconsistency of |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
- Coverage 94.82% 94.73% -0.10%
==========================================
Files 5 5
Lines 1043 1044 +1
==========================================
Hits 989 989
- Misses 54 55 +1 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Milan Bouchet-Valat <[email protected]>
|
||
# Pairs of test vectors | ||
# Some were inspired by https://github.com/JuliaData/SentinelArrays.jl/issues/97 | ||
int_vectors = [ |
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.
Instead of a hard-coded set of test vectors, could a few 1000 be generated when the test runs? That might catch a few more edge cases.
Also, I think it would be clearer to only test Int
here, to avoid NaN
and floating point rounding.
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 think that is part of @Seelengrab 's Supposition.jl is supposed to do. I'm just trying to get this pull request through before I start messing with adding test dependencies, but we seem to be stuck here.
With
|
Wait... why is sum failing?
Should SentinelArrays.jl/src/chainedvector.jl Line 784 in d13560a
Why not just use
|
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.
These changes look good. I think sum
is allowed to perform the reduction in any order, so it's fine if it is only approximately equal.
Currently thinking about function Base.mapreduce(f::F, op::OP, x::ChainedVector) where {F, OP}
init = mapreduce(f, op, first(x.arrays))
foreach(@view x.arrays[begin+1:end]) do a
init = mapreduce(f, op, a; init)
end
return init
end This may be another pull request though. |
This pull request adds more tests including randomly generated
ChainVector
s ofInt
,Float64
, andRational
, incorporates #98 .Functions fixed
(Already fixed)argmin
argmax
(Already fixed)findmin
findmax
findXwithfirst
Fixed #101