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

add missing constructor for ReverseOrdering() and tidy sort tests #33736

Merged
merged 1 commit into from
Nov 17, 2019

Conversation

oxinabox
Copy link
Contributor

@oxinabox oxinabox commented Nov 1, 2019

This came up in JuliaCollections/DataStructures.jl#547
It seems natural that we should have a zero argument constructor for ReverseOrdering
that matchs to the Reverse constant.

Yes, there are other orderings one might want to reverse,
but this is the default one,
and it would be nice to be able to construct it from the type alone.

When I went to add tests I saw the sorting tests were not testing ordering much,
and also were not fully in testsets, so I fixed that

@test_throws ArgumentError sortperm!(view([1,2,3,4], 1:4), [2,3,1])
end

@testset "misc sorting" begin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not extatic about this testsets name.
Should I just take these back out and maybe put them at the top?

@@ -27,11 +27,12 @@ end

ReverseOrdering(rev::ReverseOrdering) = rev.fwd
ReverseOrdering(fwd::Fwd) where {Fwd} = ReverseOrdering{Fwd}(fwd)
ReverseOrdering() = ReverseOrdering(ForwardOrdering())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the focus of this PR

@oxinabox
Copy link
Contributor Author

oxinabox commented Nov 6, 2019

Bump

@oxinabox oxinabox changed the title add missing costructor for ReverseOrdering() and tidy sort tests add missing constructor for ReverseOrdering() and tidy sort tests Nov 11, 2019
@oxinabox
Copy link
Contributor Author

@kmsquire can you take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants