@@ -405,6 +405,13 @@ arrayts = (Array, JLArray)
405405 @test size (b) == size (a)
406406 @test blocksize (b) == blocksize (a)
407407
408+ # Regression test for https://github.com/ITensor/BlockSparseArrays.jl/issues/98
409+ a = dev (BlockSparseArray {elt} (undef))
410+ b = similar (a, Float64, (Base. OneTo (1 ),))
411+ @test b isa BlockSparseVector{Float64}
412+ @test size (b) == (1 ,)
413+ @test blocksize (b) == (1 ,)
414+
408415 a = dev (BlockSparseArray {elt} (undef, [2 , 3 ], [3 , 4 ]))
409416 b = @view a[[Block (2 ), Block (1 )], [Block (2 ), Block (1 )]]
410417 c = @view b[Block (1 , 1 )]
@@ -1126,6 +1133,15 @@ arrayts = (Array, JLArray)
11261133 @test reshape (a[Block (2 , 1 )], 8 ) == b[Block (2 )]
11271134 @test blockstoredlength (b) == 2
11281135 @test storedlength (b) == 17
1136+
1137+ # Zero-dimensional limit (check for ambiguity errors).
1138+ # Regression test for https://github.com/ITensor/BlockSparseArrays.jl/issues/98.
1139+ a = dev (BlockSparseArray {elt} (undef, ()))
1140+ a[Block ()] = dev (randn (elt, ()))
1141+ b = blockreshape (a)
1142+ @test a[Block ()] == b[Block ()]
1143+ @test blockstoredlength (b) == 1
1144+ @test storedlength (b) == 1
11291145 end
11301146 @testset " show" begin
11311147 vectort_elt = arrayt{elt,1 }
0 commit comments