From f3f45946526d8fc92c8344acab814a342eeb052b Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Thu, 10 Dec 2020 15:52:39 -0500 Subject: [PATCH] A few missing AbstractArray tests (#38806) --- test/abstractarray.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/abstractarray.jl b/test/abstractarray.jl index 4efbd78e2f10b..0e194b71cc8bc 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -605,16 +605,24 @@ function test_cat(::Type{TestAbstractArray}) b_int = reshape([1:27...], 3, 3, 3) b_float = reshape(Float64[1:27...], 3, 3, 3) b2hcat = Array{Float64}(undef, 3, 6, 3) + b2vcat = Array{Float64}(undef, 6, 3, 3) b1 = reshape([1:9...], 3, 3) b2 = reshape([10:18...], 3, 3) b3 = reshape([19:27...], 3, 3) b2hcat[:, :, 1] = hcat(b1, b1) b2hcat[:, :, 2] = hcat(b2, b2) b2hcat[:, :, 3] = hcat(b3, b3) + b2vcat[:, :, 1] = vcat(b1, b1) + b2vcat[:, :, 2] = vcat(b2, b2) + b2vcat[:, :, 3] = vcat(b3, b3) b3hcat = Array{Float64}(undef, 3, 9, 3) b3hcat[:, :, 1] = hcat(b1, b1, b1) b3hcat[:, :, 2] = hcat(b2, b2, b2) b3hcat[:, :, 3] = hcat(b3, b3, b3) + b3vcat = Array{Float64}(undef, 9, 3, 3) + b3vcat[:, :, 1] = vcat(b1, b1, b1) + b3vcat[:, :, 2] = vcat(b2, b2, b2) + b3vcat[:, :, 3] = vcat(b3, b3, b3) B = TSlow(b_int) B1 = TSlow([1:24...]) B2 = TSlow([1:25...]) @@ -625,14 +633,20 @@ function test_cat(::Type{TestAbstractArray}) i = rand(1:10) @test cat(;dims=i) == Any[] + @test Base.typed_hcat(Float64) == Vector{Float64}() + @test Base.typed_vcat(Float64) == Vector{Float64}() @test vcat() == Any[] @test hcat() == Any[] + @test vcat(1, 1.0, 3, 3.0) == [1.0, 1.0, 3.0, 3.0] @test hcat(1, 1.0, 3, 3.0) == [1.0 1.0 3.0 3.0] @test_throws ArgumentError hcat(B1, B2) @test_throws ArgumentError vcat(C1, C2) @test vcat(B) == B @test hcat(B) == B + @test Base.typed_vcat(Float64, B) == TSlow(b_float) + @test Base.typed_vcat(Float64, B, B) == TSlow(b2vcat) + @test Base.typed_vcat(Float64, B, B, B) == TSlow(b3vcat) @test Base.typed_hcat(Float64, B) == TSlow(b_float) @test Base.typed_hcat(Float64, B, B) == TSlow(b2hcat) @test Base.typed_hcat(Float64, B, B, B) == TSlow(b3hcat)