Skip to content

Commit

Permalink
Add newly discovered bug as a broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Jun 7, 2024
1 parent 55cae4b commit ae5c19d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ using Test: @test, @test_broken, @test_throws, @testset
include("TestBlockSparseArraysUtils.jl")
@testset "BlockSparseArrays (eltype=$elt)" for elt in
(Float32, Float64, ComplexF32, ComplexF64)
@testset "Broken" begin
# TODO: These are broken, need to fix.
a = BlockSparseArray{elt}([2, 3], [2, 3])
for I in (Block.(1:2), [Block(1), Block(2)])
b = @view a[I, I]
x = randn(elt, 2, 2)
b[Block(1, 1)] = x
# These outputs a block of zeros,
# for some reason the block
# is not getting set.
# I think the issue is that:
# ```julia
# @view(@view(a[I, I]))[Block(1, 1)]
# ```
# creates a doubly-wrapped SubArray
# instead of flattening down to a
# single SubArray wrapper.
@test_broken a[Block(1, 1)] == x
@test_broken b[Block(1, 1)] == x
end
end
@testset "Basics" begin
a = BlockSparseArray{elt}([2, 3], [2, 3])
@test a == BlockSparseArray{elt}(blockedrange([2, 3]), blockedrange([2, 3]))
Expand Down

0 comments on commit ae5c19d

Please sign in to comment.