Skip to content

Commit

Permalink
Add unit tests for WithoutMissingVector (#48636)
Browse files Browse the repository at this point in the history
* Add unit tests for WithoutMissingVector
  • Loading branch information
LilithHafner authored Feb 13, 2023
1 parent 43cc94d commit f687991
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/sorting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,18 @@ end
@testset "Unions with missing" begin
@test issorted(sort(shuffle!(vcat(fill(missing, 10), rand(Int, 100)))))
@test issorted(sort(vcat(rand(Int8, 600), [missing])))

# Because we define defalg(::AbstractArray{Missing})
@test all(fill(missing, 10) .=== sort(fill(missing, 10)))

# Unit tests for WithoutMissingVector
a = [1,7,missing,4]
@test_throws ArgumentError Base.Sort.WithoutMissingVector(a)
@test eltype(a[[1,2,4]]) == eltype(a)
@test eltype(Base.Sort.WithoutMissingVector(a[[1,2,4]])) == Int
am = Base.Sort.WithoutMissingVector(a, unsafe=true)
@test am[2] == 7
@test eltype(am) == Int
end

@testset "Specific algorithms" begin
Expand Down

0 comments on commit f687991

Please sign in to comment.