Revision 5aaff189acc1d229d05c42718b3ffa28f73b40f9 authored by TEC on 10 September 2023, 05:13:49 UTC, committed by TEC on 20 October 2023, 18:14:11 UTC
1 parent 0569c57
smallarrayshrink.jl
@testset "shrink small array" begin
x = [1, 2, 3, 4]
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 4
sizehint!(x, 10000)
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 10000
sizehint!(x, 4)
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 4
x = [1, 2, 3, 4]
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 4
sizehint!(x, 1000000)
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 1000000
sizehint!(x, 4)
@test x[1] == 1
@test x[2] == 2
@test x[3] == 3
@test x[4] == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 0) == 4
@test ccall(:jl_array_size, Int, (Any, UInt), x, 1) == 4
end
Computing file changes ...