@@ -459,9 +459,10 @@ Base.Int(a::WeirdInteger) = a
459459 ]
460460
461461 offsets = size.(one_based_axes[1 ], 1 )
462- offsets_big = map(big, offsets)
462+ # Test with different integer offset types (Int8, Int16, Int32, Int64, Int128, BigInt)
463+ offsets_all = [map(T, offsets) for T in (Int8, Int16, Int32, Int64, Int128, BigInt)]
463464
464- for inds in Any[offsets, offsets_big , one_based_axes... ]
465+ for inds in Any[offsets_all ... , one_based_axes... ]
465466 # test indices API
466467 a = OffsetVector{Float64}(undef, inds)
467468 @test eltype(a) === Float64
@@ -489,7 +490,7 @@ Base.Int(a::WeirdInteger) = a
489490 end
490491
491492 # nested OffsetVectors
492- for inds in Any[offsets, offsets_big]
493+ for inds in offsets_all
493494 a = OffsetVector{Float64}(undef, inds)
494495 b = OffsetVector(a, inds); b2 = OffsetVector(a, inds... );
495496 @test eltype(b) === eltype(b2) === Float64
@@ -653,9 +654,10 @@ Base.Int(a::WeirdInteger) = a
653654 ]
654655
655656 offsets = size.(one_based_axes[1 ], 1 )
656- offsets_big = map(big, offsets)
657+ # Test with different integer offset types (Int8, Int16, Int32, Int64, Int128, BigInt)
658+ offsets_all = [map(T, offsets) for T in (Int8, Int16, Int32, Int64, Int128, BigInt)]
657659
658- for inds in Any[offsets, offsets_big , one_based_axes... ]
660+ for inds in Any[offsets_all ... , one_based_axes... ]
659661 # test API
660662 a = OffsetMatrix{Float64}(undef, inds)
661663 ax = (IdOffsetRange(Base. OneTo(4 ), 0 ), IdOffsetRange(Base. OneTo(3 ), 0 ))
@@ -682,7 +684,7 @@ Base.Int(a::WeirdInteger) = a
682684 @test_throws Union{ArgumentError, ErrorException} OffsetMatrix{Float64}(undef, 2 , - 2 ) # only positive numbers works
683685
684686 # nested OffsetMatrices
685- for inds in Any[offsets, offsets_big]
687+ for inds in offsets_all
686688 a = OffsetMatrix{Float64}(undef, inds)
687689 b = OffsetMatrix(a, inds); b2 = OffsetMatrix(a, inds... );
688690 @test eltype(b) === eltype(b2) === Float64
@@ -857,9 +859,9 @@ Base.Int(a::WeirdInteger) = a
857859 # ndim of an OffsetArray should match that of the parent
858860 @test_throws TypeError OffsetArray{Float64,3 ,Matrix{Float64}}
859861
860- # should throw a TypeError if the offsets can not be converted to Ints
861- # this test does not work anymore?
862- @test_throws TypeError OffsetVector{Int,Vector{Int}}(zeros(Int,2 ), (WeirdInteger(1 ),))
862+ # should throw an error if the offset type doesn't support proper arithmetic operations
863+ # (previously threw TypeError when converting to Int, now throws during overflow_check)
864+ @test_throws Exception OffsetVector{Int,Vector{Int}}(zeros(Int,2 ), (WeirdInteger(1 ),))
863865 end
864866
865867 @testset " custom range types" begin
0 commit comments