Skip to content

Commit 7077574

Browse files
committed
Test blockrange
1 parent 1eb9ad7 commit 7077574

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

test/test_basics.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ using BlockSparseArrays:
2222
BlockSparseMatrix,
2323
BlockSparseVector,
2424
BlockView,
25-
blockstoredlength,
25+
blockrange,
2626
blockreshape,
27-
eachblockstoredindex,
28-
eachstoredblock,
27+
blockstoredlength,
2928
blockstype,
3029
blocktype,
30+
eachblockaxis,
31+
eachblockstoredindex,
32+
eachstoredblock,
3133
sparsemortar,
3234
view!
3335
using GPUArraysCore: @allowscalar

test/test_blockrange.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using BlockArrays: Block, blocklength
2+
using BlockSparseArrays: blockrange, eachblockaxis
3+
using Test: @test, @testset
4+
5+
@testset "blockrange" begin
6+
r = blockrange(AbstractUnitRange{Int}[Base.OneTo(3), 1:4])
7+
@test eachblockaxis(r) == [Base.OneTo(3), 1:4]
8+
@test eachblockaxis(r)[1] === Base.OneTo(3)
9+
@test eachblockaxis(r)[2] === 1:4
10+
@test r[Block(1)] == 1:3
11+
@test r[Block(2)] == 4:7
12+
@test first(r) == 1
13+
@test last(r) == 7
14+
@test blocklength(r) == 2
15+
@test r == 1:7
16+
end

0 commit comments

Comments
 (0)