diff --git a/base/abstractarray.jl b/base/abstractarray.jl index be993d85e66fd..aed86b92d0cf1 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -1727,7 +1727,7 @@ for all `i` and `j`. # Examples ```jldoctest -julia> a = reshape(collect(1:16),(2,2,2,2)) +julia> a = reshape(Vector(1:16),(2,2,2,2)) 2×2×2×2 Array{Int64,4}: [:, :, 1, 1] = 1 3 diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index ee208780fffa2..d5343c922d4e3 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -51,7 +51,7 @@ Elements of `dims` must be unique and within the range `1:ndims(A)`. # Examples ```jldoctest -julia> a = reshape(collect(1:4),(2,2,1,1)) +julia> a = reshape(Vector(1:4),(2,2,1,1)) 2×2×1×1 Array{Int64,4}: [:, :, 1, 1] = 1 3 @@ -186,7 +186,7 @@ first dimension. # Examples ```jldoctest -julia> b = reshape(collect(1:16), (4,4)) +julia> b = reshape(Vector(1:16), (4,4)) 4×4 Array{Int64,2}: 1 5 9 13 2 6 10 14 diff --git a/base/array.jl b/base/array.jl index 980880fb1aea6..ad7fd65b547e0 100644 --- a/base/array.jl +++ b/base/array.jl @@ -1334,7 +1334,7 @@ for reverse-order iteration without making a copy. # Examples ```jldoctest -julia> A = collect(1:5) +julia> A = Vector(1:5) 5-element Array{Int64,1}: 1 2 @@ -1392,7 +1392,7 @@ In-place version of [`reverse`](@ref). # Examples ```jldoctest -julia> A = collect(1:5) +julia> A = Vector(1:5) 5-element Array{Int64,1}: 1 2 @@ -2117,7 +2117,7 @@ The function `f` is passed one argument. # Examples ```jldoctest -julia> filter!(isodd, collect(1:10)) +julia> filter!(isodd, Vector(1:10)) 5-element Array{Int64,1}: 1 3 diff --git a/base/linalg/qr.jl b/base/linalg/qr.jl index 21e5263dc3c87..c38695e8b3dcf 100644 --- a/base/linalg/qr.jl +++ b/base/linalg/qr.jl @@ -161,7 +161,7 @@ end function qrfactPivotedUnblocked!(A::StridedMatrix) m, n = size(A) - piv = collect(UnitRange{BlasInt}(1,n)) + piv = Vector(UnitRange{BlasInt}(1,n)) τ = Vector{eltype(A)}(uninitialized, min(m,n)) for j = 1:min(m,n) diff --git a/base/multidimensional.jl b/base/multidimensional.jl index aa6a3cf5bf74d..03b64a9ea797e 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -31,7 +31,7 @@ module IteratorsMD # Examples ```jldoctest - julia> A = reshape(collect(1:16), (2, 2, 2, 2)) + julia> A = reshape(Vector(1:16), (2, 2, 2, 2)) 2×2×2×2 Array{Int64,4}: [:, :, 1, 1] = 1 3 @@ -1306,7 +1306,7 @@ arrays have overlapping indices, then on the domain of the overlap # Examples ```julia-repl -julia> src = reshape(collect(1:16), (4,4)) +julia> src = reshape(Vector(1:16), (4,4)) 4×4 Array{Int64,2}: 1 5 9 13 2 6 10 14 @@ -1706,7 +1706,7 @@ Return unique regions of `A` along dimension `dim`. # Examples ```jldoctest -julia> A = map(isodd, reshape(collect(1:8), (2,2,2))) +julia> A = map(isodd, reshape(Vector(1:8), (2,2,2))) 2×2×2 Array{Bool,3}: [:, :, 1] = true true @@ -1816,7 +1816,7 @@ Compute the minimum and maximum elements of an array over the given dimensions. # Examples ```jldoctest -julia> A = reshape(collect(1:2:16), (2,2,2)) +julia> A = reshape(Vector(1:2:16), (2,2,2)) 2×2×2 Array{Int64,3}: [:, :, 1] = 1 5 diff --git a/base/permuteddimsarray.jl b/base/permuteddimsarray.jl index bf7c73f25071d..372d43d11bbdf 100644 --- a/base/permuteddimsarray.jl +++ b/base/permuteddimsarray.jl @@ -87,7 +87,7 @@ See also: [`PermutedDimsArray`](@ref). # Examples ```jldoctest -julia> A = reshape(collect(1:8), (2,2,2)) +julia> A = reshape(Vector(1:8), (2,2,2)) 2×2×2 Array{Int64,3}: [:, :, 1] = 1 3 diff --git a/base/random/misc.jl b/base/random/misc.jl index 68abece65b197..7dac792e88bd0 100644 --- a/base/random/misc.jl +++ b/base/random/misc.jl @@ -158,7 +158,7 @@ optionally supplying the random-number generator `rng`. ```jldoctest julia> rng = MersenneTwister(1234); -julia> shuffle!(rng, collect(1:16)) +julia> shuffle!(rng, Vector(1:16)) 16-element Array{Int64,1}: 2 15 @@ -204,7 +204,7 @@ indices, see [`randperm`](@ref). ```jldoctest julia> rng = MersenneTwister(1234); -julia> shuffle(rng, collect(1:10)) +julia> shuffle(rng, Vector(1:10)) 10-element Array{Int64,1}: 6 1 diff --git a/base/reducedim.jl b/base/reducedim.jl index 27ff8ecbe0ee5..e0a491e7c83ed 100644 --- a/base/reducedim.jl +++ b/base/reducedim.jl @@ -255,7 +255,7 @@ faster because the intermediate array is avoided. # Examples ```jldoctest -julia> a = reshape(collect(1:16), (4,4)) +julia> a = reshape(Vector(1:16), (4,4)) 4×4 Array{Int64,2}: 1 5 9 13 2 6 10 14 @@ -289,7 +289,7 @@ associativity, e.g. left-to-right, you should write your own loop. See documenta # Examples ```jldoctest -julia> a = reshape(collect(1:16), (4,4)) +julia> a = reshape(Vector(1:16), (4,4)) 4×4 Array{Int64,2}: 1 5 9 13 2 6 10 14 diff --git a/base/reshapedarray.jl b/base/reshapedarray.jl index 005be471253b4..5c06c19ecda8b 100644 --- a/base/reshapedarray.jl +++ b/base/reshapedarray.jl @@ -52,7 +52,7 @@ the specified dimensions is equal to the length of the original array `A`. The total number of elements must not change. ```jldoctest -julia> A = collect(1:16) +julia> A = Vector(1:16) 16-element Array{Int64,1}: 1 2 diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 7c5c27d49f443..eaec3b2b03e9c 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -729,7 +729,7 @@ end function sparse(D::Diagonal{T}) where T m = length(D.diag) - return SparseMatrixCSC(m, m, collect(1:(m+1)), collect(1:m), Vector{T}(D.diag)) + return SparseMatrixCSC(m, m, Vector(1:(m+1)), Vector(1:m), Vector{T}(D.diag)) end ## Transposition and permutation methods diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl index 649b8252062ca..68c58ca03797f 100644 --- a/base/sparse/sparsevector.jl +++ b/base/sparse/sparsevector.jl @@ -188,7 +188,7 @@ function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, combine::Fun len = i end end - _sparsevector!(collect(I), collect(V), len, combine) + _sparsevector!(Vector(I), Vector(V), len, combine) end function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, len::Integer, combine::Function) @@ -197,7 +197,7 @@ function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, len::Integer for i in I 1 <= i <= len || throw(ArgumentError("An index is out of bound.")) end - _sparsevector!(collect(I), collect(V), len, combine) + _sparsevector!(Vector(I), Vector(V), len, combine) end sparsevec(I::AbstractVector, V::Union{Number, AbstractVector}, args...) = @@ -849,8 +849,8 @@ function SparseMatrixCSC{Tv,Ti}(x::AbstractSparseVector) where {Tv,Ti} colptr = Ti[1, m+1] # Note that this *cannot* share data like normal array conversions, since # modifying one would put the other in an inconsistent state - rowval = collect(Ti, xnzind) - nzval = collect(Tv, xnzval) + rowval = Vector{Ti}(xnzind) + nzval = Vector{Tv}(xnzval) SparseMatrixCSC(n, 1, colptr, rowval, nzval) end @@ -1934,7 +1934,7 @@ function sort(x::SparseVector{Tv,Ti}; kws...) where {Tv,Ti} sinds = sortperm(allvals;kws...) n,k = length(x),length(allvals) z = findfirst(equalto(k),sinds) - newnzind = collect(Ti,1:k-1) + newnzind = Vector{Ti}(1:k-1) newnzind[z:end] .+= n-k+1 newnzvals = allvals[deleteat!(sinds[1:k],z)] SparseVector(n,newnzind,newnzvals) diff --git a/stdlib/Dates/src/arithmetic.jl b/stdlib/Dates/src/arithmetic.jl index c1c1a623533b7..f1ca82e71c087 100644 --- a/stdlib/Dates/src/arithmetic.jl +++ b/stdlib/Dates/src/arithmetic.jl @@ -95,5 +95,5 @@ end (-)(y::T, x::AbstractArray{T}) where {T<:TimeType} = y .- x # AbstractArray{TimeType}, AbstractArray{TimeType} -(-)(x::OrdinalRange{T}, y::OrdinalRange{T}) where {T<:TimeType} = collect(x) - collect(y) -(-)(x::AbstractRange{T}, y::AbstractRange{T}) where {T<:TimeType} = collect(x) - collect(y) +(-)(x::OrdinalRange{T}, y::OrdinalRange{T}) where {T<:TimeType} = Vector(x) - Vector(y) +(-)(x::AbstractRange{T}, y::AbstractRange{T}) where {T<:TimeType} = Vector(x) - Vector(y) diff --git a/stdlib/Distributed/test/topology.jl b/stdlib/Distributed/test/topology.jl index 32b868e5e1d81..2de3791bfcf4a 100644 --- a/stdlib/Distributed/test/topology.jl +++ b/stdlib/Distributed/test/topology.jl @@ -51,7 +51,7 @@ function launch(manager::TopoTestManager, params::Dict, launched::Array, c::Cond wconfig.process = io wconfig.io = io.out wconfig.ident = i - wconfig.connect_idents = collect(i+2:2:manager.np) + wconfig.connect_idents = Vector(i+2:2:manager.np) push!(launched, wconfig) end diff --git a/test/abstractarray.jl b/test/abstractarray.jl index 910372bf4a077..fba67fb5d168b 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -157,7 +157,7 @@ end @test CartesianIndices(0:3,3:5,-101:-100)[l] == CartesianIndex(i-1, j+2, k-102) end - local A = reshape(collect(1:9), (3,3)) + local A = reshape(Vector(1:9), (3,3)) @test CartesianIndices(size(A))[6] == CartesianIndex(3,2) @test LinearIndices(size(A))[3, 2] == 6 @test CartesianIndices(A)[6] == CartesianIndex(3,2) @@ -256,7 +256,7 @@ Base.setindex!(A::TSlow{T,5}, v, i1::Int, i2::Int, i3::Int, i4::Int, i5::Int) wh const can_inline = Base.JLOptions().can_inline != 0 function test_scalar_indexing(::Type{T}, shape, ::Type{TestAbstractArray}) where T N = prod(shape) - A = reshape(collect(1:N), shape) + A = reshape(Vector(1:N), shape) B = T(A) @test A == B # Test indexing up to 5 dimensions @@ -379,7 +379,7 @@ end function test_vector_indexing(::Type{T}, shape, ::Type{TestAbstractArray}) where T @testset "test_vector_indexing{$(T)}" begin N = prod(shape) - A = reshape(collect(1:N), shape) + A = reshape(Vector(1:N), shape) B = T(A) trailing5 = CartesianIndex(ntuple(x->1, max(ndims(B)-5, 0))) trailing4 = CartesianIndex(ntuple(x->1, max(ndims(B)-4, 0))) @@ -425,7 +425,7 @@ end function test_primitives(::Type{T}, shape, ::Type{TestAbstractArray}) where T N = prod(shape) - A = reshape(collect(1:N), shape) + A = reshape(Vector(1:N), shape) B = T(A) # last(a) @@ -489,7 +489,7 @@ mutable struct UnimplementedArray{T, N} <: AbstractArray{T, N} end function test_getindex_internals(::Type{T}, shape, ::Type{TestAbstractArray}) where T N = prod(shape) - A = reshape(collect(1:N), shape) + A = reshape(Vector(1:N), shape) B = T(A) @test getindex(A, 1) == 1 @@ -509,7 +509,7 @@ end function test_setindex!_internals(::Type{T}, shape, ::Type{TestAbstractArray}) where T N = prod(shape) - A = reshape(collect(1:N), shape) + A = reshape(Vector(1:N), shape) B = T(A) Base.unsafe_setindex!(B, 2, 1) @@ -610,7 +610,7 @@ function test_ind2sub(::Type{TestAbstractArray}) n = rand(2:5) dims = tuple(rand(1:5, n)...) len = prod(dims) - A = reshape(collect(1:len), dims...) + A = reshape(Vector(1:len), dims...) I = CartesianIndices(dims) for i in 1:len @test A[I[i]] == A[i] @@ -791,7 +791,7 @@ for A in (rand(2), rand(2,3)) for (i, v) in pairs(A) @test A[i] == v end - @test collect(values(A)) == collect(A) + @test Array(values(A)) == A end # nextind @@ -807,7 +807,7 @@ end @testset "zero-dimensional copy" begin Z = Array{Int,0}(uninitialized); Z[] = 17 - @test Z == collect(Z) == copy(Z) + @test Z == Array(Z) == copy(Z) end @testset "empty" begin diff --git a/test/arrayops.jl b/test/arrayops.jl index 402ae878e062a..c6207b4d283d3 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -94,7 +94,7 @@ using Main.TestHelpers.OAs @test Vector(a) !== a end @testset "reshaping SubArrays" begin - a = collect(reshape(1:5, 1, 5)) + a = Array(reshape(1:5, 1, 5)) @testset "linearfast" begin s = view(a, :, 2:4) r = reshape(s, (length(s),)) @@ -195,7 +195,7 @@ end end @testset "operations with IndexLinear ReshapedArray" begin - b = collect(1:12) + b = Vector(1:12) a = Base.ReshapedArray(b, (4,3), ()) @test a[3,2] == 7 @test a[6] == 6 @@ -276,8 +276,8 @@ end @test find(occursin(Int[]), a) == Int[] @test find(occursin(a), Int[]) == Int[] - a = collect(1:3:15) - b = collect(2:4:10) + a = Vector(1:3:15) + b = Vector(2:4:10) @test find(occursin(b), a) == [4] @test find(occursin(b), [a[1:4]; a[4:end]]) == [4,5] @@ -468,7 +468,7 @@ end @test find(c -> c == 'l', s) == [3] g = Base.Unicode.graphemes("日本語") @test find(isascii, g) == Int[] - @test find(!iszero, (i % 2 for i in 1:10)) == collect(1:2:9) + @test find(!iszero, (i % 2 for i in 1:10)) == 1:2:9 end @testset "findn" begin b = findn(fill(1,2,2,2,2)) @@ -570,7 +570,7 @@ end @test pointer(cp) == pointer(c) @test_throws ArgumentError pointer(cp, 2) @test strides(cp) == (9,3,1) - ap = PermutedDimsArray(collect(a), (2,1,3)) + ap = PermutedDimsArray(Array(a), (2,1,3)) @test strides(ap) == (3,1,12) for A in [rand(1,2,3,4),rand(2,2,2,2),rand(5,6,5,6),rand(1,1,1,1)] @@ -1137,7 +1137,7 @@ end @testset "filter!" begin # base case w/ Vector - a = collect(1:10) + a = Vector(1:10) filter!(x -> x > 5, a) @test a == 6:10 @@ -1153,9 +1153,9 @@ end @test isempty(ea) # non-1-indexed array - oa = OffsetArray(collect(1:10), -5) + oa = OffsetArray(Vector(1:10), -5) filter!(x -> x > 5, oa) - @test oa == OffsetArray(collect(6:10), -5) + @test oa == OffsetArray(Vector(6:10), -5) # empty non-1-indexed array eoa = OffsetArray([], -5) @@ -1227,7 +1227,7 @@ end A14 = [11 13; 12 14] R = CartesianIndices(axes(A14)) @test [a for (a,b) in pairs(IndexLinear(), A14)] == [1,2,3,4] - @test [a for (a,b) in pairs(IndexCartesian(), A14)] == vec(collect(R)) + @test [a for (a,b) in pairs(IndexCartesian(), A14)] == vec(Array(R)) @test [b for (a,b) in pairs(IndexLinear(), A14)] == [11,12,13,14] @test [b for (a,b) in pairs(IndexCartesian(), A14)] == [11,12,13,14] end @@ -1591,7 +1591,7 @@ end @test eltype(R) <: CartesianIndex{2} @test eltype(typeof(R)) <: CartesianIndex{2} @test eltype(CartesianIndices{2}) <: CartesianIndex{2} - indices = collect(R) + indices = Array(R) @test indices[1] == CartesianIndex{2}(2,3) @test indices[2] == CartesianIndex{2}(3,3) @test indices[4] == CartesianIndex{2}(5,3) @@ -1631,7 +1631,7 @@ end val, state = next(itr, state) @test done(itr, state) @test r[val] == 3 - r = sparse(collect(2:3:8)) + r = sparse(2:3:8) itr = eachindex(r) state = start(itr) @test !done(itr, state) @@ -1770,7 +1770,7 @@ end @test (1:5) + (1.5:5.5) == 2.5:2.0:10.5 @testset "slicedim" begin - for A in (reshape(collect(1:20), 4, 5), + for A in (reshape(Vector(1:20), 4, 5), reshape(1:20, 4, 5)) local A @test slicedim(A, 1, 2) == 2:4:20 @@ -1778,7 +1778,7 @@ end @test_throws ArgumentError slicedim(A,0,1) @test slicedim(A, 3, 1) == A @test_throws BoundsError slicedim(A, 3, 2) - @test @inferred(slicedim(A, 1, 2:2)) == collect(2:4:20)' + @test @inferred(slicedim(A, 1, 2:2)) == Vector(2:4:20)' end end diff --git a/test/functional.jl b/test/functional.jl index d7b9026ea61cb..400ff89def3f6 100644 --- a/test/functional.jl +++ b/test/functional.jl @@ -111,7 +111,7 @@ let gen = (x for x in 1:10) end let gen = (x * y for x in 1:10, y in 1:10) - @test collect(gen) == collect(1:10) .* collect(1:10)' + @test collect(gen) == Vector(1:10) .* Vector(1:10)' @test first(gen) == 1 @test collect(gen)[1:10] == 1:10 end diff --git a/test/hashing.jl b/test/hashing.jl index b414c05c52ceb..782d9eb618d05 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -96,7 +96,7 @@ vals = Any[ for a in vals, b in vals @test isequal(a,b) == (hash(a)==hash(b)) if a isa AbstractArray - @test hash(a) == hash(collect(a)) == hash(collect(Any, a)) + @test hash(a) == hash(Array(a)) == hash(Array{Any}(a)) end end @@ -166,7 +166,7 @@ vals = Any[ ] for a in vals - @test hash(collect(a)) == hash(a) + @test hash(Array(a)) == hash(a) end @test hash(SubString("--hello--",3,7)) == hash("hello") diff --git a/test/linalg/diagonal.jl b/test/linalg/diagonal.jl index 2c8fb4cab6539..4eca24ff7afee 100644 --- a/test/linalg/diagonal.jl +++ b/test/linalg/diagonal.jl @@ -117,7 +117,7 @@ srand(1) b = sparse(b) @test ldiv!(D, copy(b)) ≈ Array(D)\Array(b) @test_throws SingularException ldiv!(Diagonal(zeros(elty, n)), copy(b)) - b = view(rand(elty, n), collect(1:n)) + b = view(rand(elty, n), Vector(1:n)) b2 = copy(b) c = ldiv!(D, b) d = Array(D)\b2 @@ -126,7 +126,7 @@ srand(1) b = rand(elty, n+1, n+1) b = sparse(b) @test_throws DimensionMismatch ldiv!(D, copy(b)) - b = view(rand(elty, n+1), collect(1:n+1)) + b = view(rand(elty, n+1), Vector(1:n+1)) @test_throws DimensionMismatch ldiv!(D, b) end end diff --git a/test/linalg/generic.jl b/test/linalg/generic.jl index 6e3ed0f8a6a57..a6c20f4e858da 100644 --- a/test/linalg/generic.jl +++ b/test/linalg/generic.jl @@ -163,10 +163,10 @@ end α, β = 'f', 'g' @test_throws DimensionMismatch Base.LinAlg.axpy!(α,x,['g']) @test_throws DimensionMismatch Base.LinAlg.axpby!(α,x,β,['g']) - @test_throws BoundsError Base.LinAlg.axpy!(α,x,collect(-1:5),y,collect(1:7)) - @test_throws BoundsError Base.LinAlg.axpy!(α,x,collect(1:7),y,collect(-1:5)) - @test_throws BoundsError Base.LinAlg.axpy!(α,x,collect(1:7),y,collect(1:7)) - @test_throws DimensionMismatch Base.LinAlg.axpy!(α,x,collect(1:3),y,collect(1:5)) + @test_throws BoundsError Base.LinAlg.axpy!(α,x,Vector(-1:5),y,Vector(1:7)) + @test_throws BoundsError Base.LinAlg.axpy!(α,x,Vector(1:7),y,Vector(-1:5)) + @test_throws BoundsError Base.LinAlg.axpy!(α,x,Vector(1:7),y,Vector(1:7)) + @test_throws DimensionMismatch Base.LinAlg.axpy!(α,x,Vector(1:3),y,Vector(1:5)) end @test !issymmetric(fill(1,5,3)) diff --git a/test/linalg/qr.jl b/test/linalg/qr.jl index 5757c6f44b4eb..0054173a65fed 100644 --- a/test/linalg/qr.jl +++ b/test/linalg/qr.jl @@ -188,7 +188,7 @@ end @test Base.LinAlg.qr!(Int[1]) == (Int[1],1) B = rand(7,2) - @test (1:7)\B ≈ collect(1:7)\B + @test (1:7)\B ≈ Vector(1:7)\B end @testset "Issue 16520" begin @@ -204,7 +204,7 @@ end @testset "Issue 24107" begin A = rand(200,2) - @test A \ linspace(0,1,200) == A \ collect(linspace(0,1,200)) + @test A \ linspace(0,1,200) == A \ Vector(linspace(0,1,200)) end @testset "Issue #24589. Promotion of rational matrices" begin diff --git a/test/offsetarray.jl b/test/offsetarray.jl index f27a59983eb3b..61b45c48adfea 100644 --- a/test/offsetarray.jl +++ b/test/offsetarray.jl @@ -32,12 +32,12 @@ S = OffsetArray(view(A0, 1:2, 1:2), (-1,2)) # IndexCartesian @test_throws BoundsError A[0,3,2] @test_throws BoundsError S[0,3,2] # partial indexing -S3 = OffsetArray(view(reshape(collect(1:4*3*1), 4, 3, 1), 1:3, 1:2, :), (-1,-2,1)) +S3 = OffsetArray(view(reshape(Vector(1:4*3*1), 4, 3, 1), 1:3, 1:2, :), (-1,-2,1)) @test S3[1,-1] == 2 @test S3[1,0] == 6 @test_throws BoundsError S3[1,1] @test_throws BoundsError S3[1,-2] -S4 = OffsetArray(view(reshape(collect(1:4*3*2), 4, 3, 2), 1:3, 1:2, :), (-1,-2,1)) +S4 = OffsetArray(view(reshape(Vector(1:4*3*2), 4, 3, 2), 1:3, 1:2, :), (-1,-2,1)) @test S4[1,-1,2] == 2 @test S4[1,0,2] == 6 @test_throws BoundsError S4[1,1,2] @@ -123,16 +123,16 @@ S = view(A, :, :) @test_throws BoundsError S[1,1] @test axes(S) === (0:1, 3:4) # https://github.com/JuliaArrays/OffsetArrays.jl/issues/27 -g = OffsetArray(collect(-2:3), (-3,)) +g = OffsetArray(Vector(-2:3), (-3,)) gv = view(g, -1:2) @test axes(gv, 1) === Base.OneTo(4) -@test collect(gv) == collect(-1:2) +@test collect(gv) == -1:2 gv = view(g, OffsetArray(-1:2, (-2,))) @test axes(gv, 1) === -1:2 -@test collect(gv) == collect(-1:2) +@test collect(gv) == -1:2 gv = view(g, OffsetArray(-1:2, (-1,))) @test axes(gv, 1) === 0:3 -@test collect(gv) == collect(-1:2) +@test collect(gv) == -1:2 # iteration for (a,d) in zip(A, A0) @@ -430,7 +430,7 @@ v = OffsetArray(rand(8), (-2,)) @test circshift(A, (-1,2)) == OffsetArray(circshift(parent(A), (-1,2)), A.offsets) -src = reshape(collect(1:16), (4,4)) +src = reshape(Vector(1:16), (4,4)) dest = OffsetArray(Matrix{Int}(uninitialized, 4,4), (-1,1)) circcopy!(dest, src) @test parent(dest) == [8 12 16 4; 5 9 13 1; 6 10 14 2; 7 11 15 3] diff --git a/test/perf/sparse/getindex.jl b/test/perf/sparse/getindex.jl index 03d6a6f36b267..64595ea50dbdf 100644 --- a/test/perf/sparse/getindex.jl +++ b/test/perf/sparse/getindex.jl @@ -57,7 +57,7 @@ function sparse_getindex_perf() intinds = nothing logicalinds = nothing # needs to be generated for a specific matrix size. rangeinds = 121:237 - orderedinds = collect(rangeinds) + orderedinds = Vector(rangeinds) disorderedinds = orderedinds[randperm(length(orderedinds))] inds = [(intinds, "integers"), (logicalinds, "logical array"), (rangeinds, "a range"), diff --git a/test/random.jl b/test/random.jl index e36d04c519ac1..b687d66de15a2 100644 --- a/test/random.jl +++ b/test/random.jl @@ -483,9 +483,9 @@ let mta = MersenneTwister(42), mtb = MersenneTwister(42) @test randsubseq(mta,1:10,0.4) == randsubseq(mtb,1:10,0.4) @test randsubseq!(mta,Int[],1:10,0.4) == randsubseq!(mtb,Int[],1:10,0.4) - @test shuffle(mta,collect(1:10)) == shuffle(mtb,collect(1:10)) - @test shuffle!(mta,collect(1:10)) == shuffle!(mtb,collect(1:10)) - @test shuffle(mta,collect(2:11)) == shuffle(mtb,2:11) + @test shuffle(mta,Vector(1:10)) == shuffle(mtb,Vector(1:10)) + @test shuffle!(mta,Vector(1:10)) == shuffle!(mtb,Vector(1:10)) + @test shuffle(mta,Vector(2:11)) == shuffle(mtb,2:11) @test shuffle!(mta, rand(mta, 2, 3)) == shuffle!(mtb, rand(mtb, 2, 3)) @test shuffle(mta, rand(mta, 2, 3)) == shuffle(mtb, rand(mtb, 2, 3)) diff --git a/test/ranges.jl b/test/ranges.jl index c12bb55473aa1..4df601e4e981b 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -251,7 +251,7 @@ end @test length(1:2:0) == 0 end @testset "find(::OccursIn, ::Array)" begin - @test find(occursin(3:20), [5.2, 3.3]) == find(occursin(collect(3:20)), [5.2, 3.3]) + @test find(occursin(3:20), [5.2, 3.3]) == find(occursin(Vector(3:20)), [5.2, 3.3]) let span = 5:20, r = -7:3:42 @@ -505,8 +505,8 @@ end (0, 1, 5, 0), (0, -10, 5, 0), (0, -10, 0, 1), (0, -1, 1, 0), (0, 1, -1, 0), (0, -1, -10, 11)) r = start/10:step/10:stop/10 - a = collect(start:step:stop)./10 - ra = collect(r) + a = Vector(start:step:stop)./10 + ra = Vector(r) @test r == a @test isequal(r, a) @@ -519,7 +519,7 @@ end if len > 0 l = linspace(start/10, stop/10, len) - la = collect(l) + la = Vector(l) @test a == l @test r == l @@ -536,8 +536,8 @@ end @test 1.0:1/49:27.0 == linspace(1.0,27.0,1275) == [49:1323;]./49 @test isequal(1.0:1/49:27.0, linspace(1.0,27.0,1275)) - @test isequal(1.0:1/49:27.0, collect(49:1323)./49) - @test hash(1.0:1/49:27.0) == hash(linspace(1.0,27.0,1275)) == hash(collect(49:1323)./49) + @test isequal(1.0:1/49:27.0, Vector(49:1323)./49) + @test hash(1.0:1/49:27.0) == hash(linspace(1.0,27.0,1275)) == hash(Vector(49:1323)./49) @test [prevfloat(0.1):0.1:0.3;] == [prevfloat(0.1), 0.2, 0.3] @test [nextfloat(0.1):0.1:0.3;] == [nextfloat(0.1), 0.2] @@ -691,12 +691,12 @@ end linspace(0, 1, 20), map(Float32, linspace(0, 1, 20))] for r in Rs local r - ar = collect(r) + ar = Vector(r) @test r == ar @test isequal(r,ar) @test hash(r) == hash(ar) for s in Rs - as = collect(s) + as = Vector(s) @test isequal(r,s) == (hash(r)==hash(s)) @test (r==s) == (ar==as) end @@ -950,15 +950,15 @@ end function test_linspace_identity(r::AbstractRange{T}, mr) where T @test -r == mr - @test -collect(r) == collect(mr) + @test -Vector(r) == Vector(mr) @test isa(-r, typeof(r)) @test broadcast(+, broadcast(+, 1, r), -1) == r - @test 1 .+ collect(r) == collect(1 .+ r) == collect(r .+ 1) + @test 1 .+ Vector(r) == Vector(1 .+ r) == Vector(r .+ 1) @test isa(broadcast(+, broadcast(+, 1, r), -1), typeof(r)) @test broadcast(-, broadcast(-, 1, r), 1) == mr - @test 1 .- collect(r) == collect(1 .- r) == collect(1 .+ mr) - @test collect(r) .- 1 == collect(r .- 1) == -collect(mr .+ 1) + @test 1 .- Vector(r) == Vector(1 .- r) == Vector(1 .+ mr) + @test Vector(r) .- 1 == Vector(r .- 1) == -Vector(mr .+ 1) @test isa(broadcast(-, broadcast(-, 1, r), 1), typeof(r)) @test 1 * r * 1 == r @@ -969,9 +969,9 @@ end @test r / T(0.5) * T(0.5) == r @test isa(r / 1, typeof(r)) - @test (2 * collect(r) == collect(r * 2) == collect(2 * r) == - collect(r * T(2.0)) == collect(T(2.0) * r) == - collect(r / T(0.5)) == -collect(mr * T(2.0))) + @test (2 * Vector(r) == Vector(r * 2) == Vector(2 * r) == + Vector(r * T(2.0)) == Vector(T(2.0) * r) == + Vector(r / T(0.5)) == -Vector(mr * T(2.0))) end test_linspace_identity(linspace(1.0, 27.0, 10), linspace(-1.0, -27.0, 10)) @@ -1024,10 +1024,10 @@ end @test r1 - r2 == r_diff @test r2 - r1 == -r_diff - @test collect(r1) + collect(r2) == collect(r_sum) - @test collect(r2) + collect(r1) == collect(r_sum) - @test collect(r1) - collect(r2) == collect(r_diff) - @test collect(r2) - collect(r1) == collect(-r_diff) + @test Vector(r1) + Vector(r2) == Vector(r_sum) + @test Vector(r2) + Vector(r1) == Vector(r_sum) + @test Vector(r1) - Vector(r2) == Vector(r_diff) + @test Vector(r2) - Vector(r1) == Vector(-r_diff) end test_range_sum_diff(1:5, 0:2:8, 1:3:13, 1:-1:-3) @@ -1196,11 +1196,11 @@ Base.isless(x, y::NotReal) = isless(x, y.val) isdefined(Main, :TestHelpers) || @eval Main include("TestHelpers.jl") using Main.TestHelpers: Furlong @testset "dimensional correctness" begin - @test length(collect(Furlong(2):Furlong(10))) == 9 + @test length(Vector(Furlong(2):Furlong(10))) == 9 @test length(range(Furlong(2), 9)) == 9 - @test collect(Furlong(2):Furlong(1):Furlong(10)) == collect(range(Furlong(2),Furlong(1),9)) == Furlong.(2:10) - @test collect(Furlong(1.0):Furlong(0.5):Furlong(10.0)) == - collect(Furlong(1):Furlong(0.5):Furlong(10)) == Furlong.(1:0.5:10) + @test Vector(Furlong(2):Furlong(1):Furlong(10)) == Vector(range(Furlong(2),Furlong(1),9)) == Furlong.(2:10) + @test Vector(Furlong(1.0):Furlong(0.5):Furlong(10.0)) == + Vector(Furlong(1):Furlong(0.5):Furlong(10)) == Furlong.(1:0.5:10) end @testset "issue #22270" begin diff --git a/test/reduce.jl b/test/reduce.jl index 67b7160304155..546f29218a0bd 100644 --- a/test/reduce.jl +++ b/test/reduce.jl @@ -43,7 +43,7 @@ @test mapreduce(-, +, [-10]) == 10 @test mapreduce(abs2, +, [-9, -3]) == 81 + 9 @test mapreduce(-, +, [-9, -3, -4, 8, -2]) == (9 + 3 + 4 - 8 + 2) -@test mapreduce(-, +, collect(linspace(1.0, 10000.0, 10000))) == -50005000.0 +@test mapreduce(-, +, Vector(linspace(1.0, 10000.0, 10000))) == -50005000.0 # empty mr @test mapreduce(abs2, +, Float64[]) === 0.0 @test mapreduce(abs2, Base.scalarmax, Float64[]) === 0.0 @@ -209,7 +209,7 @@ prod2(itr) = invoke(prod, Tuple{Any}, itr) @test minimum(abs2, 3:7) == 9 @test maximum(Int16[1]) === Int16(1) -@test maximum(collect(Int16(1):Int16(100))) === Int16(100) +@test maximum(Vector(Int16(1):Int16(100))) === Int16(100) @test maximum(Int32[1,2]) === Int32(2) A = circshift(reshape(1:24,2,3,4), (0,1,1)) @@ -357,8 +357,8 @@ let es = sum(BigFloat.(z)), es2 = sum(BigFloat.(z[1:10^5])) @test (es2 - cs[10^5]) < es2 * 1e-13 end -@test sum(collect(map(UInt8,0:255))) == 32640 -@test sum(collect(map(UInt8,254:255))) == 509 +@test sum(Vector(map(UInt8,0:255))) == 32640 +@test sum(Vector(map(UInt8,254:255))) == 509 A = reshape(map(UInt8, 101:109), (3,3)) @test @inferred(sum(A)) == 945 @@ -374,7 +374,7 @@ A = reshape(map(UInt8, 1:100), (10,10)) @test prod([-0.0, -0.0]) === 0.0 #contains -let A = collect(1:10) +let A = Vector(1:10) @test A ∋ 5 @test A ∌ 11 @test any(y->y==6,A) diff --git a/test/show.jl b/test/show.jl index b852e512f0afe..fd8a025478e1e 100644 --- a/test/show.jl +++ b/test/show.jl @@ -586,8 +586,8 @@ end # This fits on screen: @test replstr(Matrix(1.0I, 10, 10)) == "10×10 Array{Float64,2}:\n 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0" # an array too long vertically to fit on screen, and too long horizontally: -@test replstr(collect(1.:100.)) == "100-element Array{Float64,1}:\n 1.0\n 2.0\n 3.0\n 4.0\n 5.0\n 6.0\n 7.0\n 8.0\n 9.0\n 10.0\n ⋮ \n 92.0\n 93.0\n 94.0\n 95.0\n 96.0\n 97.0\n 98.0\n 99.0\n 100.0" -@test replstr(collect(1.:100.)') == "1×100 Adjoint{Float64,Array{Float64,1}}:\n 1.0 2.0 3.0 4.0 5.0 6.0 7.0 … 95.0 96.0 97.0 98.0 99.0 100.0" +@test replstr(Vector(1.:100.)) == "100-element Array{Float64,1}:\n 1.0\n 2.0\n 3.0\n 4.0\n 5.0\n 6.0\n 7.0\n 8.0\n 9.0\n 10.0\n ⋮ \n 92.0\n 93.0\n 94.0\n 95.0\n 96.0\n 97.0\n 98.0\n 99.0\n 100.0" +@test replstr(Vector(1.:100.)') == "1×100 Adjoint{Float64,Array{Float64,1}}:\n 1.0 2.0 3.0 4.0 5.0 6.0 7.0 … 95.0 96.0 97.0 98.0 99.0 100.0" # too big in both directions to fit on screen: @test replstr((1.:100.)*(1:100)') == "100×100 Array{Float64,2}:\n 1.0 2.0 3.0 4.0 5.0 6.0 … 97.0 98.0 99.0 100.0\n 2.0 4.0 6.0 8.0 10.0 12.0 194.0 196.0 198.0 200.0\n 3.0 6.0 9.0 12.0 15.0 18.0 291.0 294.0 297.0 300.0\n 4.0 8.0 12.0 16.0 20.0 24.0 388.0 392.0 396.0 400.0\n 5.0 10.0 15.0 20.0 25.0 30.0 485.0 490.0 495.0 500.0\n 6.0 12.0 18.0 24.0 30.0 36.0 … 582.0 588.0 594.0 600.0\n 7.0 14.0 21.0 28.0 35.0 42.0 679.0 686.0 693.0 700.0\n 8.0 16.0 24.0 32.0 40.0 48.0 776.0 784.0 792.0 800.0\n 9.0 18.0 27.0 36.0 45.0 54.0 873.0 882.0 891.0 900.0\n 10.0 20.0 30.0 40.0 50.0 60.0 970.0 980.0 990.0 1000.0\n ⋮ ⋮ ⋱ \n 92.0 184.0 276.0 368.0 460.0 552.0 8924.0 9016.0 9108.0 9200.0\n 93.0 186.0 279.0 372.0 465.0 558.0 9021.0 9114.0 9207.0 9300.0\n 94.0 188.0 282.0 376.0 470.0 564.0 9118.0 9212.0 9306.0 9400.0\n 95.0 190.0 285.0 380.0 475.0 570.0 9215.0 9310.0 9405.0 9500.0\n 96.0 192.0 288.0 384.0 480.0 576.0 … 9312.0 9408.0 9504.0 9600.0\n 97.0 194.0 291.0 388.0 485.0 582.0 9409.0 9506.0 9603.0 9700.0\n 98.0 196.0 294.0 392.0 490.0 588.0 9506.0 9604.0 9702.0 9800.0\n 99.0 198.0 297.0 396.0 495.0 594.0 9603.0 9702.0 9801.0 9900.0\n 100.0 200.0 300.0 400.0 500.0 600.0 9700.0 9800.0 9900.0 10000.0" @@ -1031,7 +1031,7 @@ let x = TypeVar(:_), y = TypeVar(:_) end @testset "showarg" begin - A = reshape(collect(Int16(1):Int16(2*3*5)), 2, 3, 5) + A = reshape(Vector(Int16(1):Int16(2*3*5)), 2, 3, 5) @test summary(A) == "2×3×5 Array{Int16,3}" v = view(A, :, 3, 2:5) @test summary(v) == "2×4 view(::Array{Int16,3}, :, 3, 2:5) with eltype Int16" diff --git a/test/simdloop.jl b/test/simdloop.jl index 4909101cc108d..72513a1311d3b 100644 --- a/test/simdloop.jl +++ b/test/simdloop.jl @@ -144,5 +144,5 @@ function simd_sum_over_array(a) end s end -@test 2001000 == simd_sum_over_array(collect(1:2000)) +@test 2001000 == simd_sum_over_array(Vector(1:2000)) @test 2001000 == simd_sum_over_array(Float32[i+j*500 for i=1:500, j=0:3]) diff --git a/test/sorting.jl b/test/sorting.jl index 7d969627b0ca9..e8fc91ce94a5d 100644 --- a/test/sorting.jl +++ b/test/sorting.jl @@ -20,7 +20,7 @@ end @test partialsort([3,6,30,1,9],3) == 6 @test partialsort([3,6,30,1,9],3:4) == [6,9] @test partialsortperm([3,6,30,1,9], 3:4) == [2,5] -@test partialsortperm!(collect(1:5), [3,6,30,1,9], 3:4) == [2,5] +@test partialsortperm!(Vector(1:5), [3,6,30,1,9], 3:4) == [2,5] let a=[1:10;] for r in Any[2:4, 1:2, 10:10, 4:2, 2:1, 4:-1:2, 2:-1:1, 10:-1:10, 4:1:3, 1:2:8, 10:-3:1] @test partialsort(a, r) == [r;] diff --git a/test/sparse/sparse.jl b/test/sparse/sparse.jl index 4727949818754..a40ed7aaabe4c 100644 --- a/test/sparse/sparse.jl +++ b/test/sparse/sparse.jl @@ -867,7 +867,7 @@ end @test nnz(A) == 13 @test count(!iszero, A) == 3 @test A[lininds] == A[X] == zeros(Int, 10) - c = collect(11:20); c[1] = c[3] = 0 + c = Vector(11:20); c[1] = c[3] = 0 A[lininds] = c @test nnz(A) == 13 @test count(!iszero, A) == 11 @@ -1707,8 +1707,8 @@ end end @testset "issue #13008" begin - @test_throws ArgumentError sparse(collect(1:100), collect(1:100), fill(5,100), 5, 5) - @test_throws ArgumentError sparse(Int[], collect(1:5), collect(1:5)) + @test_throws ArgumentError sparse(Vector(1:100), Vector(1:100), fill(5,100), 5, 5) + @test_throws ArgumentError sparse(Int[], Vector(1:5), Vector(1:5)) end @testset "issue #13024" begin @@ -1864,7 +1864,7 @@ end # are called. (Issue #18705.) EDIT: #19239 unified broadcast over a single sparse matrix, # eliminating the former operation classes. @testset "issue #18705" begin - S = sparse(Diagonal(collect(1.0:5.0))) + S = sparse(Diagonal(1.0:5.0)) @test isa(sin.(S), SparseMatrixCSC) end @@ -1906,7 +1906,7 @@ end # Check that `broadcast` methods specialized for unary operations over # `SparseMatrixCSC`s determine a reasonable return type. @testset "issue #18974" begin - S = sparse(Diagonal(collect(Int64(1):Int64(4)))) + S = sparse(Diagonal(Int64(1):Int64(4))) @test eltype(sin.(S)) == Float64 end diff --git a/test/sparse/sparsevector.jl b/test/sparse/sparsevector.jl index d2a822cd03226..da1d471508f61 100644 --- a/test/sparse/sparsevector.jl +++ b/test/sparse/sparsevector.jl @@ -1083,7 +1083,7 @@ sv[1] = 0 # Compare stored zero semantics between SparseVector and SparseMatrixCSC let S = SparseMatrixCSC(10,1,[1,6],[1,3,5,6,7],[0,1,2,0,3]), x = SparseVector(10,[1,3,5,6,7],[0,1,2,0,3]) @test nnz(S) == nnz(x) == 5 - for I = (:, 1:10, collect(1:10)) + for I = (:, 1:10, Vector(1:10)) @test S[I,1] == S[I] == x[I] == x @test nnz(S[I,1]) == nnz(S[I]) == nnz(x[I]) == nnz(x) end @@ -1112,19 +1112,19 @@ end @testset "Issue 14589" begin # test vectors with no zero elements let x = sparsevec(1:7, [3., 2., -1., 1., -2., -3., 3.], 7) - @test collect(sort(x)) == sort(collect(x)) + @test Vector(sort(x)) == sort(Vector(x)) end # test vectors with all zero elements let x = sparsevec(Int64[], Float64[], 7) - @test collect(sort(x)) == sort(collect(x)) + @test Vector(sort(x)) == sort(Vector(x)) end # test vector with sparsity approx 1/2 let x = sparsevec(1:7, [3., 2., -1., 1., -2., -3., 3.], 15) - @test collect(sort(x)) == sort(collect(x)) + @test Vector(sort(x)) == sort(Vector(x)) # apply three distinct tranformations where zeros sort into start/middle/end - @test collect(sort(x, by=abs)) == sort(collect(x), by=abs) - @test collect(sort(x, by=sign)) == sort(collect(x), by=sign) - @test collect(sort(x, by=inv)) == sort(collect(x), by=inv) + @test Vector(sort(x, by=abs)) == sort(Vector(x), by=abs) + @test Vector(sort(x, by=sign)) == sort(Vector(x), by=sign) + @test Vector(sort(x, by=inv)) == sort(Vector(x), by=inv) end end @testset "fill!" begin diff --git a/test/statistics.jl b/test/statistics.jl index 5b6154260fb2f..86f00340c833d 100644 --- a/test/statistics.jl +++ b/test/statistics.jl @@ -107,19 +107,19 @@ end @test var([1], 1; mean=[2], corrected=false) ≈ [1.0] @test var(1:8) == 6. - @test varm(1:8,1) == varm(collect(1:8),1) + @test varm(1:8,1) == varm(Vector(1:8),1) @test isnan(varm(1:1,1)) @test isnan(var(1:1)) @test isnan(var(1:-1)) @test @inferred(var(1.0:8.0)) == 6. - @test varm(1.0:8.0,1.0) == varm(collect(1.0:8.0),1) + @test varm(1.0:8.0,1.0) == varm(Vector(1.0:8.0),1) @test isnan(varm(1.0:1.0,1.0)) @test isnan(var(1.0:1.0)) @test isnan(var(1.0:-1.0)) @test @inferred(var(1.0f0:8.0f0)) === 6.f0 - @test varm(1.0f0:8.0f0,1.0f0) == varm(collect(1.0f0:8.0f0),1) + @test varm(1.0f0:8.0f0,1.0f0) == varm(Vector(1.0f0:8.0f0),1) @test isnan(varm(1.0f0:1.0f0,1.0f0)) @test isnan(var(1.0f0:1.0f0)) @test isnan(var(1.0f0:-1.0f0)) @@ -328,7 +328,7 @@ end @test cor(1:17, 1:17) <= 1.0 @test cor(1:17, 18:34) <= 1.0 let tmp = linspace(1, 85, 100) - tmp2 = collect(tmp) + tmp2 = Vector(tmp) @test cor(tmp, tmp) <= 1.0 @test cor(tmp, tmp2) <= 1.0 end @@ -338,9 +338,9 @@ end @test quantile([1,2,3,4],0.5) == 2.5 @test quantile([1,2,3,4],[0.5]) == [2.5] @test quantile([1., 3],[.25,.5,.75])[2] == median([1., 3]) - @test quantile(100.0:-1.0:0.0, 0.0:0.1:1.0) == collect(0.0:10.0:100.0) - @test quantile(0.0:100.0, 0.0:0.1:1.0, sorted=true) == collect(0.0:10.0:100.0) - @test quantile(100f0:-1f0:0.0, 0.0:0.1:1.0) == collect(0f0:10f0:100f0) + @test quantile(100.0:-1.0:0.0, 0.0:0.1:1.0) == 0.0:10.0:100.0 + @test quantile(0.0:100.0, 0.0:0.1:1.0, sorted=true) == 0.0:10.0:100.0 + @test quantile(100f0:-1f0:0.0, 0.0:0.1:1.0) == 0f0:10f0:100f0 @test quantile([Inf,Inf],0.5) == Inf @test quantile([-Inf,1],0.5) == -Inf @test quantile([0,1],1e-18) == 1e-18 @@ -417,7 +417,7 @@ isdefined(Main, :TestHelpers) || @eval Main include("TestHelpers.jl") using Main.TestHelpers: Furlong @testset "Unitful elements" begin r = Furlong(1):Furlong(1):Furlong(2) - a = collect(r) + a = Vector(r) @test sum(r) == sum(a) == Furlong(3) @test cumsum(r) == Furlong.([1,3]) @test mean(r) == mean(a) == median(a) == median(r) == Furlong(1.5) diff --git a/test/subarray.jl b/test/subarray.jl index b23a267fc80ec..3a1917ac9367c 100644 --- a/test/subarray.jl +++ b/test/subarray.jl @@ -486,12 +486,12 @@ end # issue #15168 let A = rand(10), sA = view(copy(A), :) @test sA[Int16(1)] === sA[Int32(1)] === sA[Int64(1)] === A[1] - permute!(sA, collect(Int16, 1:10)) + permute!(sA, Vector{Int16}(1:10)) @test A == sA end # the following segfaults with LLVM 3.8 on Windows, ref #15417 -@test collect(view(view(reshape(1:13^3, 13, 13, 13), 3:7, 6:6, :), 1:2:5, :, 1:2:5)) == +@test Array(view(view(reshape(1:13^3, 13, 13, 13), 3:7, 6:6, :), 1:2:5, :, 1:2:5)) == cat(3,[68,70,72],[406,408,410],[744,746,748]) # tests @view (and replace_ref_end!)