Revision 2dd4a694dda894264c2432088921b0f8a068afb0 authored by Keno Fischer on 02 March 2022, 04:04:51 UTC, committed by Keno Fischer on 02 March 2022, 04:04:51 UTC
1 parent e54ebeb
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
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...