Skip to content

Commit 9ac437d

Browse files
committed
Improve test coverage
1 parent 87a76cd commit 9ac437d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/core.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ end
279279

280280
@test isnothing(@inferred(ArrayInterface.known_first(typeof(1:4))))
281281
@test isone(@inferred(ArrayInterface.known_first(Base.OneTo(4))))
282+
@test isone(@inferred(ArrayInterface.known_first(Base.IdentityUnitRange(Base.OneTo(4)))))
283+
@test isone(@inferred(ArrayInterface.known_first(LinearIndices((1, 1, 1)))))
282284
@test isone(@inferred(ArrayInterface.known_first(typeof(Base.OneTo(4)))))
283285
@test @inferred(ArrayInterface.known_first(typeof(CI))) == CartesianIndex(1, 1)
284286
@test @inferred(ArrayInterface.known_first(typeof(CI))) == CartesianIndex(1, 1)
@@ -303,6 +305,9 @@ end
303305
A2r = reinterpret(ComplexF64, A2)
304306

305307
@test @inferred(ArrayInterface.known_size(1)) === ()
308+
@test @inferred(ArrayInterface.known_size([1, 1]')) === (1, nothing)
309+
@test @inferred(ArrayInterface.known_size(view([1, 1]', :, 1))) === (1, )
310+
@test @inferred(ArrayInterface.known_size(Diagonal(view([1, 1]', :, 1)))) === (1, 1)
306311
@test @inferred(ArrayInterface.known_size(view(rand(4), reshape(1:4, 2, 2)))) == (nothing, nothing)
307312
@test @inferred(ArrayInterface.known_size(A)) === (nothing, nothing, nothing)
308313
@test @inferred(ArrayInterface.known_size(Ap)) === (nothing, nothing)
@@ -311,5 +316,10 @@ end
311316
@test ArrayInterface.known_size(Ar, 4) === 1
312317
@test @inferred(ArrayInterface.known_size(A2)) === (nothing, nothing, nothing)
313318
@test @inferred(ArrayInterface.known_size(A2r)) === (nothing, nothing, nothing)
319+
320+
@test @inferred(ArrayInterface.known_length(1)) === 1
321+
@test @inferred(ArrayInterface.known_length(Base.Slice(1:2))) === nothing
322+
@test @inferred(ArrayInterface.known_length(CartesianIndex(1, 2, 3))) === 3
323+
@test @inferred(ArrayInterface.known_length((x = 1, y = 2))) === 2
314324
end
315325

0 commit comments

Comments
 (0)