@@ -8,6 +8,9 @@ using LinearAlgebra
88using  Base:  IdentityUnitRange
99using  Test
1010
11+ Base. values (r:: IdOffsetRange ) =  first (r): last (r)
12+ axes1based (a) =  map (values, axes (a))
13+ 
1114if  ! isdefined (@__MODULE__ , :T24Linear )
1215    include (" testhelpers/arrayindexingtypes.jl"  )
1316end 
@@ -484,7 +487,7 @@ I = findall(!iszero, z)
484487#  https://github.com/JuliaArrays/OffsetArrays.jl/issues/92
485488A92 =  OffsetArray (reshape (1 : 27 , 3 , 3 , 3 ), - 2 , - 2 , - 2 )
486489B92 =  view (A92, :, :, - 1 : 0 )
487- @test  axes (B92) ==  (- 1 : 1 , - 1 : 1 , 1 : 2 )
490+ @test  axes1based (B92) ==  (- 1 : 1 , - 1 : 1 , 1 : 2 )
488491@test  sum (B92, dims= (2 ,3 )) ==  OffsetArray (reshape ([51 ,57 ,63 ], Val (3 )), - 2 , - 2 , 0 )
489492B92 =  view (A92, :, :, Base. IdentityUnitRange (- 1 : 0 ))
490493@test  sum (B92, dims= (2 ,3 )) ==  OffsetArray (reshape ([51 ,57 ,63 ], Val (3 )), - 2 , - 2 , - 2 )
@@ -718,19 +721,19 @@ end
718721    @test  S[0 ,4 ] ==  S[3 ] ==  3 
719722    @test  S[1 ,4 ] ==  S[4 ] ==  4 
720723    @test_throws  BoundsError S[1 ,1 ]
721-     @test  axes (S) ==  OffsetArrays . IdOffsetRange .(( 0 : 1 , 3 : 4 ) )
724+     @test  axes1based (S) ==  ( 0 : 1 , 3 : 4 )
722725    S =  view (A, axes (A, 1 ), 3 )
723726    @test  S ==  A[:, 3 ]
724727    @test  S[0 ] ==  1 
725728    @test  S[1 ] ==  2 
726729    @test_throws  BoundsError S[length (S)]
727-     @test  axes (S) ==  (OffsetArrays . IdOffsetRange ( 0 : 1 ),  )
730+     @test  axes1based (S) ==  (0 : 1 , )
728731    S =  view (A, 1 , axes (A, 2 ))
729732    @test  S ==  A[1 , :]
730733    @test  S[3 ] ==  2 
731734    @test  S[4 ] ==  4 
732735    @test_throws  BoundsError S[1 ]
733-     @test  axes (S) ==  (OffsetArrays . IdOffsetRange ( 3 : 4 ),  )
736+     @test  axes1based (S) ==  (3 : 4 , )
734737
735738    A0 =  collect (reshape (1 : 24 , 2 , 3 , 4 ))
736739    A =  OffsetArray (A0, (- 1 ,2 ,1 ))
739742    @test  S[0 , 1 , 2 ] ==  A[0 , 3 , 2 ]
740743    @test  S[0 , 2 , 2 ] ==  A[0 , 4 , 2 ]
741744    @test  S[1 , 1 , 2 ] ==  A[1 , 3 , 2 ]
742-     @test  axes (S) ==  (OffsetArrays . IdOffsetRange ( 0 : 1 ) , Base. OneTo (2 ), OffsetArrays . IdOffsetRange ( 2 : 5 ) )
745+     @test  axes1based (S) ==  (0 : 1 , Base. OneTo (2 ), 2 : 5 )
743746end 
744747
745748@testset  " Zero-index indexing"   begin 
759762    s =  - 2 : 2 : 4 
760763    r =  5 : 8 
761764    y =  OffsetArray (s, r)
762-     @test  axes (y) ==  (r,)
765+     @test  axes1based (y) ==  (r,)
763766    @test  step (y) ==  step (s)
764767
765768    a =  OffsetVector (3 : 4 , 10 : 11 )
@@ -827,12 +830,12 @@ end
827830    @test  stack (ten .+  nought' ) ==  ten .+  nought' 
828831    @test  stack (x^ 2  for  x in  ten) ==  ten.^ 2 
829832
830-     @test  axes (stack (nought for  _ in  ten)) ==  (0 : 2 , 10 : 13 )
831-     @test  axes (stack ([nought for  _ in  ten])) ==  (0 : 2 , 10 : 13 )
832-     @test  axes (stack (nought for  _ in  ten; dims= 1 )) ==  (10 : 13 , 0 : 2 )
833-     @test  axes (stack ((x, x^ 2 ) for  x in  nought)) ==  (1 : 2 , 0 : 2 )
834-     @test  axes (stack (x ->  x[end - 1 : end ], ten for  _ in  nought, _ in  nought)) ==  (1 : 2 , 0 : 2 , 0 : 2 )
835-     @test  axes (stack ([ten[end - 1 : end ] for  _ in  nought, _ in  nought])) ==  (1 : 2 , 0 : 2 , 0 : 2 )
833+     @test  axes1based (stack (nought for  _ in  ten)) ==  (0 : 2 , 10 : 13 )
834+     @test  axes1based (stack ([nought for  _ in  ten])) ==  (0 : 2 , 10 : 13 )
835+     @test  axes1based (stack (nought for  _ in  ten; dims= 1 )) ==  (10 : 13 , 0 : 2 )
836+     @test  axes1based (stack ((x, x^ 2 ) for  x in  nought)) ==  (1 : 2 , 0 : 2 )
837+     @test  axes1based (stack (x ->  x[end - 1 : end ], ten for  _ in  nought, _ in  nought)) ==  (1 : 2 , 0 : 2 , 0 : 2 )
838+     @test  axes1based (stack ([ten[end - 1 : end ] for  _ in  nought, _ in  nought])) ==  (1 : 2 , 0 : 2 , 0 : 2 )
836839end 
837840
838841@testset  " issue #41630: replace_ref_begin_end!/@view on offset-like arrays"   begin 
0 commit comments