From f6879913d1890d0f50e7f935feeddba4cb699481 Mon Sep 17 00:00:00 2001 From: Lilith Orion Hafner Date: Mon, 13 Feb 2023 09:30:50 -0600 Subject: [PATCH] Add unit tests for WithoutMissingVector (#48636) * Add unit tests for WithoutMissingVector --- test/sorting.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/sorting.jl b/test/sorting.jl index 100c8ada35c53..15eec92166ec7 100644 --- a/test/sorting.jl +++ b/test/sorting.jl @@ -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