|
16 | 16 | @testset "Constructors" begin
|
17 | 17 | @test FixedSizeArray{Float64,0}(undef) isa FixedSizeArray{Float64,0}
|
18 | 18 | @test FixedSizeArray{Float64,0}(undef, ()) isa FixedSizeArray{Float64,0}
|
19 |
| - @test_throws ArgumentError FixedSizeArray{Float64,1}(undef, typemin(Int)) |
| 19 | + @test_throws ArgumentError FixedSizeArray{Float64,1}(undef, -1) |
| 20 | + @test_throws ArgumentError FixedSizeArray{Float64,1}(undef, (-1,)) |
| 21 | + @test_throws ArgumentError FixedSizeArray{Float64,2}(undef, -1, -1) |
20 | 22 | @test_throws ArgumentError FixedSizeArray{Float64,2}(undef, typemax(Int), typemax(Int))
|
21 | 23 | @test_throws ArgumentError FixedSizeArray{Float64,3}(undef, typemax(Int), typemax(Int), 2)
|
22 | 24 | @test_throws ArgumentError FixedSizeArray{Float64,4}(undef, typemax(Int), typemax(Int), 2, 4)
|
| 25 | + @testset "negative dimension size" begin |
| 26 | + for n ∈ 2:4 |
| 27 | + funs = ( |
| 28 | + Returns(-1), |
| 29 | + (i -> (i == 1) ? 1 : -1), |
| 30 | + (i -> (i == 1) ? -1 : 1), |
| 31 | + (i -> (i == n) ? 1 : -1), |
| 32 | + (i -> (i == n) ? -1 : 1), |
| 33 | + ) |
| 34 | + fun = f -> ntuple(f, n) |
| 35 | + sizes = map(fun, funs) |
| 36 | + for siz ∈ sizes |
| 37 | + @test_throws ArgumentError FixedSizeArray{Float64,n}(undef, siz) |
| 38 | + @test_throws ArgumentError FixedSizeArray{Float64,n}(undef, siz...) |
| 39 | + end |
| 40 | + end |
| 41 | + end |
23 | 42 | end
|
24 | 43 |
|
25 | 44 | @testset "safe computation of length from dimensions size" begin
|
|
0 commit comments