Skip to content

Commit 1eac901

Browse files
committed
Test inference
1 parent 0b5fcdb commit 1eac901

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
1818
SymmetrySectors = "f8a8ad64-adbc-4fce-92f7-ffe2bb36a86e"
1919
TensorAlgebra = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
2020
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
21+
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"

test/test_basics.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ using LinearAlgebra: Adjoint, Transpose, dot, mul!, norm
3737
using SparseArraysBase: SparseArrayDOK, SparseMatrixDOK, SparseVectorDOK, storedlength
3838
using TensorAlgebra: contract
3939
using Test: @test, @test_broken, @test_throws, @testset, @inferred
40+
using TestExtras: @constinferred
4041
include("TestBlockSparseArraysUtils.jl")
4142

4243
arrayts = (Array, JLArray)
@@ -137,30 +138,30 @@ arrayts = (Array, JLArray)
137138
end
138139
@testset "blockstype, blocktype" begin
139140
a = arrayt(randn(elt, 2, 2))
140-
@test blockstype(a) <: BlockArrays.BlocksView{elt,2}
141+
@test (@constinferred blockstype(a)) <: BlockArrays.BlocksView{elt,2}
141142
# TODO: This is difficult to determine just from type information.
142143
@test_broken blockstype(typeof(a)) <: BlockArrays.BlocksView{elt,2}
143-
@test blocktype(a) <: SubArray{elt,2,arrayt{elt,2}}
144+
@test (@constinferred blocktype(a)) <: SubArray{elt,2,arrayt{elt,2}}
144145
# TODO: This is difficult to determine just from type information.
145146
@test_broken blocktype(typeof(a)) <: SubArray{elt,2,arrayt{elt,2}}
146147

147148
a = BlockSparseMatrix{elt,arrayt{elt,2}}([1, 1], [1, 1])
148-
@test blockstype(a) <: SparseMatrixDOK{arrayt{elt,2}}
149-
@test blockstype(typeof(a)) <: SparseMatrixDOK{arrayt{elt,2}}
150-
@test blocktype(a) <: arrayt{elt,2}
151-
@test blocktype(typeof(a)) <: arrayt{elt,2}
149+
@test (@constinferred blockstype(a)) <: SparseMatrixDOK{arrayt{elt,2}}
150+
@test (@constinferred blockstype(typeof(a))) <: SparseMatrixDOK{arrayt{elt,2}}
151+
@test (@constinferred blocktype(a)) <: arrayt{elt,2}
152+
@test (@constinferred blocktype(typeof(a))) <: arrayt{elt,2}
152153

153154
a = BlockArray(arrayt(randn(elt, (2, 2))), [1, 1], [1, 1])
154-
@test blockstype(a) === Matrix{arrayt{elt,2}}
155-
@test blockstype(typeof(a)) === Matrix{arrayt{elt,2}}
156-
@test blocktype(a) <: arrayt{elt,2}
157-
@test blocktype(typeof(a)) <: arrayt{elt,2}
155+
@test (@constinferred blockstype(a)) === Matrix{arrayt{elt,2}}
156+
@test (@constinferred blockstype(typeof(a))) === Matrix{arrayt{elt,2}}
157+
@test (@constinferred blocktype(a)) <: arrayt{elt,2}
158+
@test (@constinferred blocktype(typeof(a))) <: arrayt{elt,2}
158159

159160
a = BlockedArray(arrayt(randn(elt, 2, 2)), [1, 1], [1, 1])
160-
@test blockstype(a) <: BlockArrays.BlocksView{elt,2}
161+
@test (@constinferred blockstype(a)) <: BlockArrays.BlocksView{elt,2}
161162
# TODO: This is difficult to determine just from type information.
162163
@test_broken blockstype(typeof(a)) <: BlockArrays.BlocksView{elt,2}
163-
@test blocktype(a) <: SubArray{elt,2,arrayt{elt,2}}
164+
@test (@constinferred blocktype(a)) <: SubArray{elt,2,arrayt{elt,2}}
164165
# TODO: This is difficult to determine just from type information.
165166
@test_broken blocktype(typeof(a)) <: SubArray{elt,2,arrayt{elt,2}}
166167
end

0 commit comments

Comments
 (0)