@@ -7,7 +7,6 @@ using TypedTables: Table
7
7
using DataAPI: refarray, refvalue
8
8
using Adapt: adapt, Adapt
9
9
using JLArrays
10
- using Random
11
10
using Test
12
11
13
12
using Documenter: doctest
@@ -1166,11 +1165,11 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
1166
1165
test_set = Any[s1, s2, s3, s4]
1167
1166
tested_style = Any[]
1168
1167
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)
1171
1169
ares = map (a-> a. re, as)
1172
1170
aims = map (a-> a. im, as)
1173
1171
style = Broadcast. combine_styles (ares... )
1172
+ @test Broadcast. combine_styles (as... ) === StructArrayStyle {typeof(style),1} ()
1174
1173
if ! (style in tested_style)
1175
1174
push! (tested_style, style)
1176
1175
if style isa Broadcast. ArrayStyle{MyArray3}
@@ -1216,8 +1215,7 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
1216
1215
1 ]
1217
1216
tested_style = StructArrayStyle[]
1218
1217
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)
1221
1219
if any (a -> a isa StructArray, as)
1222
1220
style = Broadcast. combine_styles (as... )
1223
1221
if ! (style in tested_style)
@@ -1229,6 +1227,12 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
1229
1227
@test length (tested_style) == 4
1230
1228
end
1231
1229
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
+
1232
1236
@testset " StructStaticArray" begin
1233
1237
bclog (s) = log .(s)
1234
1238
test_allocated (f, s) = @test (@allocated f (s)) == 0
0 commit comments