Skip to content

Commit 30e5bbd

Browse files
committed
Add regression tests
1 parent e4f0bb3 commit 30e5bbd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.4.2"
4+
version = "0.4.3"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

test/test_basics.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)