@@ -48,12 +48,39 @@ include("TestBlockSparseArraysUtils.jl")
4848 @test block_nstored (a) == 2
4949 @test nstored (a) == 2 * 4 + 3 * 3
5050
51+ b = similar (a, complex (elt))
52+ @test eltype (b) == complex (eltype (a))
53+ @test iszero (b)
54+ @test block_nstored (b) == 0
55+ @test nstored (b) == 0
56+ @test size (b) == size (a)
57+ @test blocksize (b) == blocksize (a)
58+
59+ b = copy (a)
60+ b[1 , 1 ] = 11
61+ @test b[1 , 1 ] == 11
62+ @test a[1 , 1 ] ≠ 11
63+
64+ b = copy (a)
65+ b .*= 2
66+ @test b ≈ 2 a
67+
68+ b = copy (a)
69+ b ./= 2
70+ @test b ≈ a / 2
71+
5172 b = 2 * a
5273 @test Array (b) ≈ 2 * Array (a)
5374 @test eltype (b) == elt
5475 @test block_nstored (b) == 2
5576 @test nstored (b) == 2 * 4 + 3 * 3
5677
78+ b = (2 + 3im ) * a
79+ @test Array (b) ≈ (2 + 3im ) * Array (a)
80+ @test eltype (b) == complex (elt)
81+ @test block_nstored (b) == 2
82+ @test nstored (b) == 2 * 4 + 3 * 3
83+
5784 b = a + a
5885 @test Array (b) ≈ 2 * Array (a)
5986 @test eltype (b) == elt
@@ -123,12 +150,30 @@ include("TestBlockSparseArraysUtils.jl")
123150 @test nstored (b) == 2 * 2
124151 @test block_nstored (b) == 1
125152
126- # Broken, need to fix.
153+ # # Broken, need to fix.
154+
127155 @test_broken a[Block (1 ), Block (1 ): Block (2 )]
156+
128157 # This is outputting only zero blocks.
129158 b = a[Block (2 ): Block (2 ), Block (1 ): Block (2 )]
130159 @test_broken block_nstored (b) == 1
131160 @test_broken b == Array (a)[3 : 5 , 1 : end ]
161+
162+ b = a'
163+ @test_broken block_nstored (b) == 2
164+
165+ b = transpose (a)
166+ @test_broken block_nstored (b) == 2
167+
168+ b = copy (a)
169+ x = randn (size (@view (a[Block (2 , 2 )])))
170+ b[Block (2 ), Block (2 )] = x
171+ @test_broken b[Block (2 , 2 )] == x
172+
173+ # Doesnt' set the block
174+ b = copy (a)
175+ b[Block (1 , 1 )] .= 1
176+ @test_broken b[1 , 1 ] == trues (size (@view (b[1 , 1 ])))
132177 end
133178 @testset " LinearAlgebra" begin
134179 a1 = BlockSparseArray {elt} ([2 , 3 ], [2 , 3 ])
0 commit comments