@@ -11,20 +11,27 @@ m = Array{Float64}(undef, 4, 3)
11
11
@testset " LazyAxis" begin
12
12
A = zeros (3 ,4 ,5 );
13
13
SA = MArray (zeros (3 ,4 ,5 ))
14
+ DA = MArray (zeros (3 ,4 ,5 ), LinearIndices ((Base. Slice (1 : 3 ), 1 : 4 , 1 : 5 )))
14
15
lz1 = ArrayInterface. LazyAxis {1} (A)
15
16
slz1 = ArrayInterface. LazyAxis {1} (SA)
17
+ dlz1 = ArrayInterface. LazyAxis {1} (DA)
16
18
lzc = ArrayInterface. LazyAxis {:} (A)
17
19
slzc = ArrayInterface. LazyAxis {:} (SA)
18
-
19
- @test @inferred (first (lz1)) === @inferred (first (slz1))
20
- @test @inferred (first (lzc)) === @inferred (first (slzc))
21
- @test @inferred (last (lz1)) === @inferred (last (slz1))
22
- @test @inferred (last (lzc)) === @inferred (last (slzc))
23
- @test @inferred (length (lz1)) === @inferred (length (slz1))
24
- @test @inferred (length (lzc)) === @inferred (length (slzc))
25
- @test @inferred (Base. to_shape (lzc)) == length (slzc)
20
+ dlzc = ArrayInterface. LazyAxis {:} (DA)
21
+
22
+ @test @inferred (first (lz1)) === @inferred (first (slz1)) === @inferred (first (dlz1))
23
+ @test @inferred (first (lzc)) === @inferred (first (slzc)) === @inferred (first (dlzc))
24
+ @test @inferred (last (lz1)) === @inferred (last (slz1)) === @inferred (last (dlz1))
25
+ @test @inferred (last (lzc)) === @inferred (last (slzc)) === @inferred (last (dlzc))
26
+ @test @inferred (length (lz1)) === @inferred (length (slz1)) === @inferred (length (dlz1))
27
+ @test @inferred (length (lzc)) === @inferred (length (slzc)) === @inferred (length (dlzc))
28
+ @test @inferred (Base. to_shape (lzc)) == length (slzc) == length (dlzc)
26
29
@test @inferred (Base. checkindex (Bool, lzc, 1 )) & @inferred (Base. checkindex (Bool, slzc, 1 ))
27
30
@test axes (lzc)[1 ] == Base. axes1 (lzc) == axes (Base. Slice (lzc))[1 ] == Base. axes1 (Base. Slice (lzc))
31
+ @test keys (axes (A, 1 )) == @inferred (keys (lz1))
32
+
33
+ @test @inferred (ArrayInterface. known_first (slzc)) === 1
34
+ @test @inferred (ArrayInterface. known_length (slz1)) === 3
28
35
29
36
@test @inferred (getindex (lz1, 2 )) == 2
30
37
@test @inferred (getindex (lz1, 1 : 2 )) == 1 : 2
@@ -33,6 +40,8 @@ m = Array{Float64}(undef, 4, 3)
33
40
@test @inferred (ArrayInterface. parent_type (ArrayInterface. LazyAxis {:} (A))) <: Base.OneTo{Int}
34
41
@test @inferred (ArrayInterface. parent_type (ArrayInterface. LazyAxis {4} (SA))) <: ArrayInterface.SOneTo{1}
35
42
@test @inferred (ArrayInterface. parent_type (ArrayInterface. LazyAxis {:} (SA))) <: ArrayInterface.SOneTo{60}
43
+ @test @inferred (IndexStyle (SA)) isa IndexLinear
44
+ @test @inferred (IndexStyle (DA)) isa IndexLinear
36
45
@test ArrayInterface. can_change_size (ArrayInterface. LazyAxis{1 ,Vector{Any}})
37
46
38
47
Aperm = PermutedDimsArray (A, (3 ,1 ,2 ))
0 commit comments