Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,21 @@ Broadcast.broadcastable(x::ScalarTest) = Ref(x)
d = HybridVector{4}([1, 2, 3, 4])
@test_throws DimensionMismatch a .= d
end

@testset "no allocations during broadcasting" begin
# HybridArrays issue #64
# Fixed in Julia 1.11
function test_broadcast_allocs()
H = HybridArray{Tuple{2,2,StaticArrays.Dynamic()}}(randn(2,2,2))
H2 = HybridArray{Tuple{2,2,StaticArrays.Dynamic()}}(Array{Float64}(undef, 2, 2, 4))
@allocated H2[:,:,1:2] .= H
end

if VERSION >= v"1.11"
@test test_broadcast_allocs() == 0
else
@test_broken test_broadcast_allocs() == 0
end
end

end
Loading