Skip to content

Commit

Permalink
remove randperm
Browse files Browse the repository at this point in the history
  • Loading branch information
N5N3 committed Nov 22, 2022
1 parent 960e1c7 commit 14c7a84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5"

[targets]
test = ["Test", "JLArrays", "StaticArrays", "OffsetArrays", "PooledArrays", "TypedTables", "WeakRefStrings", "Documenter", "Random"]
test = ["Test", "JLArrays", "StaticArrays", "OffsetArrays", "PooledArrays", "TypedTables", "WeakRefStrings", "Documenter"]
14 changes: 9 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ using TypedTables: Table
using DataAPI: refarray, refvalue
using Adapt: adapt, Adapt
using JLArrays
using Random
using Test

using Documenter: doctest
Expand Down Expand Up @@ -1166,11 +1165,11 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
test_set = Any[s1, s2, s3, s4]
tested_style = Any[]
dotaddadd((a, b, c),) = @. a + b + c
for is in Iterators.product(randperm(4), randperm(4), randperm(4))
as = map(i -> test_set[i], is)
for as in Iterators.product(test_set, test_set, test_set)
ares = map(a->a.re, as)
aims = map(a->a.im, as)
style = Broadcast.combine_styles(ares...)
@test Broadcast.combine_styles(as...) === StructArrayStyle{typeof(style),1}()
if !(style in tested_style)
push!(tested_style, style)
if style isa Broadcast.ArrayStyle{MyArray3}
Expand Down Expand Up @@ -1216,8 +1215,7 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
1]
tested_style = StructArrayStyle[]
dotaddsub((a, b, c),) = @. a + b - c
for is in Iterators.product(randperm(6), randperm(6), randperm(6))
as = map(i -> test_set[i], is)
for as in Iterators.product(test_set, test_set, test_set)
if any(a -> a isa StructArray, as)
style = Broadcast.combine_styles(as...)
if !(style in tested_style)
Expand All @@ -1229,6 +1227,12 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
@test length(tested_style) == 4
end

@testset "allocation test" begin
a = StructArray{ComplexF64}(undef, 1)
allocated(a) = @allocated a .+ 1
@test allocated(a) == 2allocated(a.re)
end

@testset "StructStaticArray" begin
bclog(s) = log.(s)
test_allocated(f, s) = @test (@allocated f(s)) == 0
Expand Down

0 comments on commit 14c7a84

Please sign in to comment.