Skip to content

Commit 14c7a84

Browse files
committed
remove randperm
1 parent 960e1c7 commit 14c7a84

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
2323
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
2424
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
2525
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
26-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2726
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2827
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2928
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
3029
WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5"
3130

3231
[targets]
33-
test = ["Test", "JLArrays", "StaticArrays", "OffsetArrays", "PooledArrays", "TypedTables", "WeakRefStrings", "Documenter", "Random"]
32+
test = ["Test", "JLArrays", "StaticArrays", "OffsetArrays", "PooledArrays", "TypedTables", "WeakRefStrings", "Documenter"]

test/runtests.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ using TypedTables: Table
77
using DataAPI: refarray, refvalue
88
using Adapt: adapt, Adapt
99
using JLArrays
10-
using Random
1110
using Test
1211

1312
using 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) == 2allocated(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

Comments
 (0)