Skip to content

Commit

Permalink
add test for associative reductions
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Aug 27, 2024
1 parent 7a976c2 commit 2077a08
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,23 @@ end
@test getindex_count(A) == 0
end

@testset "optimization for associative reductions" begin
A = rand(1:10,30,30)
DA = AccessCountDiskArray(A,chunksize=(2,2))

for fun in (sum, prod, maximum, minimum)
@test fun(A) == fun(DA)
end

Ab = rand(Bool,30,30)
DAb = AccessCountDiskArray(Ab,chunksize=(2,2))
for fun in (count, all, any)
@test fun(Ab) == fun(DAb)
end
end

# @test offsets == [[1:1,2:3,4:4],[5:5,6:6,7:7],[8:8,9:9]]
# inds = [1,1,1,3,5,6,6,7,10,13,16,16,19,20]
# readranges, offsets = find_subranges_sorted(inds,false)
# @test readranges == [1:1, 3:3, 5:7, 10:10, 13:13, 16:16, 19:20]
# @test offsets == [[1:3], [4:4], [5:5,6:7,8:8], [9:9], [10:10], [11:12], [13:13,14:14]]
# @test offsets == [[1:3], [4:4], [5:5,6:7,8:8], [9:9], [10:10], [11:12], [13:13,14:14]]

0 comments on commit 2077a08

Please sign in to comment.