@@ -7,7 +7,6 @@ using TypedTables: Table
77using DataAPI: refarray, refvalue
88using Adapt: adapt, Adapt
99using JLArrays
10- using Random
1110using Test
1211
1312using Documenter: doctest
@@ -1166,11 +1165,11 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
11661165 test_set = Any[s1, s2, s3, s4]
11671166 tested_style = Any[]
11681167 dotaddadd ((a, b, c),) = @. a + b + c
1169- for is in Iterators. product (randperm (4 ), randperm (4 ), randperm (4 ))
1170- as = map (i -> test_set[i], is)
1168+ for as in Iterators. product (test_set, test_set, test_set)
11711169 ares = map (a-> a. re, as)
11721170 aims = map (a-> a. im, as)
11731171 style = Broadcast. combine_styles (ares... )
1172+ @test Broadcast. combine_styles (as... ) === StructArrayStyle {typeof(style),1} ()
11741173 if ! (style in tested_style)
11751174 push! (tested_style, style)
11761175 if style isa Broadcast. ArrayStyle{MyArray3}
@@ -1216,8 +1215,7 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
12161215 1 ]
12171216 tested_style = StructArrayStyle[]
12181217 dotaddsub ((a, b, c),) = @. a + b - c
1219- for is in Iterators. product (randperm (6 ), randperm (6 ), randperm (6 ))
1220- as = map (i -> test_set[i], is)
1218+ for as in Iterators. product (test_set, test_set, test_set)
12211219 if any (a -> a isa StructArray, as)
12221220 style = Broadcast. combine_styles (as... )
12231221 if ! (style in tested_style)
@@ -1229,6 +1227,12 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
12291227 @test length (tested_style) == 4
12301228 end
12311229
1230+ @testset " allocation test" begin
1231+ a = StructArray {ComplexF64} (undef, 1 )
1232+ allocated (a) = @allocated a .+ 1
1233+ @test allocated (a) == 2 allocated (a. re)
1234+ end
1235+
12321236 @testset " StructStaticArray" begin
12331237 bclog (s) = log .(s)
12341238 test_allocated (f, s) = @test (@allocated f (s)) == 0
0 commit comments