diff --git a/base/abstractarray.jl b/base/abstractarray.jl index e7a27a2ab7a14..4972221da154f 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -612,7 +612,7 @@ function circshift(a, shiftamts) for i=1:n s = size(a,i) d = i<=length(shiftamts) ? shiftamts[i] : 0 - I[i] = d==0 ? (1:s) : mod([-d:s-1-d], s)+1 + I[i] = d==0 ? (1:s) : mod([-d:s-1-d;], s)+1 end a[I...]::typeof(a) end @@ -1493,7 +1493,7 @@ function mapslices(f::Function, A::AbstractArray, dims::AbstractVector) dimsA = [size(A)...] ndimsA = ndims(A) - alldims = [1:ndimsA] + alldims = [1:ndimsA;] if dims == alldims return f(A) diff --git a/base/array.jl b/base/array.jl index 7ddecb892de91..87720d6f80f82 100644 --- a/base/array.jl +++ b/base/array.jl @@ -125,7 +125,7 @@ function reinterpret{T,S,N}(::Type{T}, a::Array{S}, dims::NTuple{N,Int}) end ccall(:jl_reshape_array, Array{T,N}, (Any, Any, Any), Array{T,N}, a, dims) end -reinterpret(t::Type,x) = reinterpret(t,[x])[1] +reinterpret(t::Type,x) = reinterpret(t,[x;])[1] function reshape{T,N}(a::Array{T}, dims::NTuple{N,Int}) if prod(dims) != length(a) diff --git a/base/base64.jl b/base/base64.jl index 25d4f1ab0c4af..53d2f5051e551 100644 --- a/base/base64.jl +++ b/base/base64.jl @@ -30,7 +30,7 @@ end # Based on code by Stefan Karpinski from https://github.com/hackerschool/WebSockets.jl (distributed under the same MIT license as Julia) -const b64chars = ['A':'Z','a':'z','0':'9','+','/'] +const b64chars = ['A':'Z';'a':'z';'0':'9';'+';'/'] function b64(x::Uint8, y::Uint8, z::Uint8) n = int(x)<<16 | int(y)<<8 | int(z) diff --git a/base/combinatorics.jl b/base/combinatorics.jl index 7a2875c3f4e56..79114f21dfe6a 100644 --- a/base/combinatorics.jl +++ b/base/combinatorics.jl @@ -190,7 +190,7 @@ function combinations(a, t::Integer) Combinations(a, t) end -start(c::Combinations) = [1:c.t] +start(c::Combinations) = [1:c.t;] function next(c::Combinations, s) comb = c.a[s] if c.t == 0 @@ -224,7 +224,7 @@ length(c::Permutations) = factorial(length(c.a)) permutations(a) = Permutations(a) -start(p::Permutations) = [1:length(p.a)] +start(p::Permutations) = [1:length(p.a);] function next(p::Permutations, s) if length(p.a) == 0 # special case to generate 1 result for len==0 @@ -329,7 +329,7 @@ function nextfixedpartition(n, m, bs) as = copy(bs) if isempty(as) # First iteration - as = [n-m+1, ones(Int, m-1)] + as = [n-m+1; ones(Int, m-1)] elseif as[2] < as[1]-1 # Most common iteration as[1] -= 1 diff --git a/base/dsp.jl b/base/dsp.jl index 9230013e36298..52b6412164e00 100644 --- a/base/dsp.jl +++ b/base/dsp.jl @@ -87,8 +87,8 @@ function conv{T<:Base.LinAlg.BlasFloat}(u::StridedVector{T}, v::StridedVector{T} nv = length(v) n = nu + nv - 1 np2 = n > 1024 ? nextprod([2,3,5], n) : nextpow2(n) - upad = [u, zeros(T, np2 - nu)] - vpad = [v, zeros(T, np2 - nv)] + upad = [u; zeros(T, np2 - nu)] + vpad = [v; zeros(T, np2 - nv)] if T <: Real p = plan_rfft(upad) y = irfft(p(upad).*p(vpad), np2) diff --git a/base/fftw.jl b/base/fftw.jl index 5c7af7b648a46..d4b27980c2101 100644 --- a/base/fftw.jl +++ b/base/fftw.jl @@ -261,7 +261,7 @@ function dims_howmany(X::StridedArray, Y::StridedArray, ist = [strides(X)...] ost = [strides(Y)...] dims = [sz[reg] ist[reg] ost[reg]]' - oreg = [1:ndims(X)] + oreg = [1:ndims(X);] oreg[reg] = 0 oreg = filter(d -> d > 0, oreg) howmany = [sz[oreg] ist[oreg] ost[oreg]]' diff --git a/base/inference.jl b/base/inference.jl index 0fc8a7e7d4cb1..318b523fc5cd6 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -1179,7 +1179,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop) la = length(args) assert(is(ast.head,:lambda)) locals = (ast.args[2][1])::Array{Any,1} - vars = [args, locals] + vars = [args; locals] body = (ast.args[3].args)::Array{Any,1} n = length(body) @@ -2054,7 +2054,7 @@ function inlining_pass(e::Expr, sv, ast) return (e,stmts) end end - e.args = [{e.args[2]}, newargs...] + e.args = [{e.args[2]}; newargs...] # now try to inline the simplified call diff --git a/base/intfuncs.jl b/base/intfuncs.jl index 35313e941daf6..9de9ae84e9463 100644 --- a/base/intfuncs.jl +++ b/base/intfuncs.jl @@ -263,8 +263,8 @@ end num2hex(n::Integer) = hex(n, sizeof(n)*2) -const base36digits = ['0':'9','a':'z'] -const base62digits = ['0':'9','A':'Z','a':'z'] +const base36digits = ['0':'9';'a':'z'] +const base62digits = ['0':'9';'A':'Z';'a':'z'] function base(b::Int, x::Unsigned, pad::Int, neg::Bool) if !(2 <= b <= 62) error("invalid base: $b") end diff --git a/base/io.jl b/base/io.jl index a6f3414e594b2..c382ac6882d3a 100644 --- a/base/io.jl +++ b/base/io.jl @@ -6,7 +6,7 @@ ## byte-order mark, ntoh & hton ## -const ENDIAN_BOM = reinterpret(Uint32,uint8([1:4]))[1] +const ENDIAN_BOM = reinterpret(Uint32, 0x1:0x4) if ENDIAN_BOM == 0x01020304 ntoh(x) = identity(x) diff --git a/base/linalg/factorization.jl b/base/linalg/factorization.jl index 299cc13084835..86d4adf234acc 100644 --- a/base/linalg/factorization.jl +++ b/base/linalg/factorization.jl @@ -161,7 +161,7 @@ function getindex{T}(A::LU{T}, d::Symbol) d == :L && return tril(A.factors[1:m, 1:min(m,n)], -1) + eye(T, m, min(m,n)) d == :U && return triu(A.factors[1:min(m,n),1:n]) if d == :p - p = [1:m] + p = [1:m;] for i in 1:length(A.ipiv) p[i], p[A.ipiv[i]] = p[A.ipiv[i]], p[i] end @@ -323,8 +323,8 @@ function \{T<:BlasFloat}(A::QRPivoted{T}, B::StridedMatrix{T}, rcond::Real) tmin, smin, cmin = LAPACK.laic1!(2, sub(xmin, 1:rnk), tmin, sub(A.hh, 1:rnk, rnk + 1), A.hh[rnk + 1, rnk + 1]) tmax, smax, cmax = LAPACK.laic1!(1, sub(xmax, 1:rnk), tmax, sub(A.hh, 1:rnk, rnk + 1), A.hh[rnk + 1, rnk + 1]) tmax*rcond > tmin && break - xmin[1:rnk + 1] = [smin*sub(xmin, 1:rnk), cmin] - xmax[1:rnk + 1] = [smax*sub(xmin, 1:rnk), cmax] + xmin[1:rnk + 1] = [smin*sub(xmin, 1:rnk); cmin] + xmax[1:rnk + 1] = [smax*sub(xmin, 1:rnk); cmax] rnk += 1 # if cond(r[1:rnk, 1:rnk])*rcond < 1 break end end diff --git a/base/linalg/generic.jl b/base/linalg/generic.jl index 775489ca9e2e3..a925dcd4db5c9 100644 --- a/base/linalg/generic.jl +++ b/base/linalg/generic.jl @@ -34,8 +34,8 @@ function diff(A::AbstractMatrix, dim::Integer) end -gradient(F::AbstractVector) = gradient(F, [1:length(F)]) -gradient(F::AbstractVector, h::Real) = gradient(F, [h*(1:length(F))]) +gradient(F::AbstractVector) = gradient(F, [1:length(F);]) +gradient(F::AbstractVector, h::Real) = gradient(F, [h*(1:length(F));]) #gradient(F::AbstractVector, h::AbstractVector) diag(A::AbstractVector) = error("use diagm instead of diag to construct a diagonal matrix") diff --git a/base/linalg/lapack.jl b/base/linalg/lapack.jl index a4d449e14c025..5e64c9e004fcf 100644 --- a/base/linalg/lapack.jl +++ b/base/linalg/lapack.jl @@ -2113,7 +2113,7 @@ for (stev, stebz, stegr, stein, elty) in function stegr!(jobz::BlasChar, range::BlasChar, dv::Vector{$elty}, ev::Vector{$elty}, vl::Real, vu::Real, il::Integer, iu::Integer) n = length(dv) if length(ev) != (n-1) throw(DimensionMismatch("stebz!")) end - eev = [ev, zero($elty)] + eev = [ev; zero($elty)] abstol = Array($elty, 1) m = Array(BlasInt, 1) w = Array($elty, n) diff --git a/base/multi.jl b/base/multi.jl index 0d26bd268438e..5ccd8ee9166ba 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -251,7 +251,7 @@ function rmprocs(args...; waitfor = 0.0) global rmprocset empty!(rmprocset) - for i in [args...] + for i in vcat(args...) if i == 1 warn("rmprocs: process 1 not removed") else diff --git a/base/pkg/resolve/maxsum.jl b/base/pkg/resolve/maxsum.jl index 70336337d1d08..fd1a08d1c9311 100644 --- a/base/pkg/resolve/maxsum.jl +++ b/base/pkg/resolve/maxsum.jl @@ -148,7 +148,7 @@ type Graph end end - perm = [1:np] + perm = [1:np;] return new(gadj, gmsk, gdir, adjdict, spp, perm, np) end diff --git a/base/sort.jl b/base/sort.jl index f54d72f99cdf0..eb35a6125eb87 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -324,7 +324,7 @@ sort(v::AbstractVector; kws...) = sort!(copy(v); kws...) sortperm(v::AbstractVector; alg::Algorithm=DEFAULT_STABLE, lt::Function=isless, by::Function=identity, rev::Bool=false, order::Ordering=Forward) = - sort!([1:length(v)], alg, Perm(ord(lt,by,rev,order),v)) + sort!([1:length(v);], alg, Perm(ord(lt,by,rev,order),v)) ## sorting multi-dimensional arrays ## diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index d341789f3fe01..23924476d4b42 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -406,8 +406,8 @@ eye(S::SparseMatrixCSC) = speye(S) function speye(T::Type, m::Integer, n::Integer) x = min(m,n) - rowval = [1:x] - colptr = [rowval, fill(int(x+1), n+1-x)] + rowval = [1:x;] + colptr = [rowval; fill(int(x+1), n+1-x)] nzval = ones(T, x) return SparseMatrixCSC(m, n, colptr, rowval, nzval) end @@ -934,7 +934,7 @@ end function getindex{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, I::AbstractVector, J::AbstractVector) m = size(A, 1) - if isa(I, Range) || isa(I, Range1); I = [I]; end + if isa(I, Range) || isa(I, Range1); I = [I;]; end if I == 1:m return getindex_cols(A, J) diff --git a/base/string.jl b/base/string.jl index e021abbbd55f5..56c8b15101491 100644 --- a/base/string.jl +++ b/base/string.jl @@ -1618,7 +1618,7 @@ rsearch(a::ByteArray, b::Union(Int8,Uint8,Char)) = rsearch(a,b,length(a)) # return a random string (often useful for temporary filenames/dirnames) let global randstring - const b = uint8(['0':'9','A':'Z','a':'z']) + const b = uint8(['0':'9';'A':'Z';'a':'z']) randstring(n::Int) = ASCIIString(b[rand(1:length(b),n)]) randstring() = randstring(8) end diff --git a/src/uv_constants.h b/src/uv_constants.h index f66e7798b1f55..4416ac4215f67 100644 --- a/src/uv_constants.h +++ b/src/uv_constants.h @@ -5,8 +5,8 @@ const uv_handle_types = [UV_HANDLE_TYPE_MAP(XX) :UV_FILE] const uv_req_types = [UV_REQ_TYPE_MAP(XX)] const uv_err_vals = [UV_ERRNO_MAP(YY)] let - handles = [:UV_UNKNOWN_HANDLE, uv_handle_types, :UV_HANDLE_TYPE_MAX, :UV_RAW_FD, :UV_RAW_HANDLE] - reqs = [:UV_UNKNOWN_REQ, uv_req_types, :UV_REQ_TYPE_PRIVATE,:UV_REQ_TYPE_MAX] + handles = [:UV_UNKNOWN_HANDLE; uv_handle_types; :UV_HANDLE_TYPE_MAX; :UV_RAW_FD; :UV_RAW_HANDLE] + reqs = [:UV_UNKNOWN_REQ; uv_req_types; :UV_REQ_TYPE_PRIVATE; :UV_REQ_TYPE_MAX] for i=0:(length(handles)-1) @eval const $(handles[i+1]) = $i end diff --git a/test/arrayops.jl b/test/arrayops.jl index 83be870ee8ce8..e4b2e043fb3ed 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -51,7 +51,7 @@ a = reshape(b, (2, 2, 2, 2, 2)) sz = (5,8,7) A = reshape(1:prod(sz),sz...) tmp = A[2:6] -@test tmp == [2:6] +@test tmp == [2:6;] tmp = A[1:3,2,2:4] @test tmp == cat(3,46:48,86:88,126:128) tmp = A[:,7:-3:1,5] @@ -123,7 +123,7 @@ sA = sub(A, 1:2:3, 1:3:5, 1:2:8) @test sA[:] == A[1:2:3, 1:3:5, 1:2:8][:] # sub logical indexing #4763 -A = sub([1:10], 5:8) +A = sub(1:10, 5:8) @test A[A.<7] == [5, 6] B = reshape(1:16, 4, 4) sB = sub(B, 2:3, 2:3) @@ -153,7 +153,7 @@ sA = slice(A, 1:2:3, 3, 1:2:8) @test strides(sA) == (2,30) @test sA[:] == A[sA.indexes...][:] -a = [5:8] +a = 5:8 @test parent(a) == a @test parentindexes(a) == (1:4,) @@ -193,13 +193,13 @@ let @test x == -12 X = get(A, -5:5, nan(Float32)) @test eltype(X) == Float32 - @test isnan(X) == [trues(6),falses(5)] + @test isnan(X) == [trues(6);falses(5)] @test X[7:11] == 1:5 X = get(A, (2:4, 9:-2:-13), 0) Xv = zeros(Int, 3, 12) Xv[1:2, 2:5] = A[2:3, 7:-2:1] @test X == Xv - X2 = get(A, Vector{Int}[[2:4], [9:-2:-13]], 0) + X2 = get(A, Vector{Int}[[2:4;], [9:-2:-13;]], 0) @test X == X2 end @@ -220,7 +220,7 @@ v = shift!(l) # concatenation @test isequal([ones(2,2) 2*ones(2,1)], [1. 1 2; 1 1 2]) -@test isequal([ones(2,2), 2*ones(1,2)], [1. 1; 1 1; 2 2]) +@test isequal([ones(2,2); 2*ones(1,2)], [1. 1; 1 1; 2 2]) # typed array literals X = Float64[1 2 3] @@ -526,9 +526,9 @@ begin 3 3 4 4 3 3 4 4; 3 3 4 4 3 3 4 4] - A = reshape([1:8], 2, 2, 2) + A = reshape(1:8, 2, 2, 2) R = repeat(A, inner = [1, 1, 2], outer = [1, 1, 1]) - T = reshape([1:4, 1:4, 5:8, 5:8], 2, 2, 4) + T = reshape([1:4; 1:4; 5:8; 5:8], 2, 2, 4) @test R == T A = Array(Int, 2, 2, 2) A[:, :, 1] = [1 2; @@ -719,9 +719,9 @@ end for idx in {1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, 8:9, 9:10, 6:9, 7:10} for repl in {[], [11], [11,22], [11,22,33,44,55]} - a = [1:10]; acopy = copy(a) + a = [1:10;]; acopy = copy(a) @test splice!(a, idx, repl) == acopy[idx] - @test a == [acopy[1:(first(idx)-1)], repl, acopy[(last(idx)+1):end]] + @test a == [acopy[1:(first(idx)-1)]; repl; acopy[(last(idx)+1):end]] end end @@ -745,15 +745,15 @@ end # reverse @test reverse([2,3,1]) == [1,3,2] -@test reverse([1:10],1,4) == [4,3,2,1,5,6,7,8,9,10] -@test reverse([1:10],3,6) == [1,2,6,5,4,3,7,8,9,10] -@test reverse([1:10],6,10) == [1,2,3,4,5,10,9,8,7,6] +@test reverse([1:10;],1,4) == [4,3,2,1,5,6,7,8,9,10] +@test reverse([1:10;],3,6) == [1,2,6,5,4,3,7,8,9,10] +@test reverse([1:10;],6,10) == [1,2,3,4,5,10,9,8,7,6] @test reverse(1:10,1,4) == [4,3,2,1,5,6,7,8,9,10] @test reverse(1:10,3,6) == [1,2,6,5,4,3,7,8,9,10] @test reverse(1:10,6,10) == [1,2,3,4,5,10,9,8,7,6] -@test reverse!([1:10],1,4) == [4,3,2,1,5,6,7,8,9,10] -@test reverse!([1:10],3,6) == [1,2,6,5,4,3,7,8,9,10] -@test reverse!([1:10],6,10) == [1,2,3,4,5,10,9,8,7,6] +@test reverse!([1:10;],1,4) == [4,3,2,1,5,6,7,8,9,10] +@test reverse!([1:10;],3,6) == [1,2,6,5,4,3,7,8,9,10] +@test reverse!([1:10;],6,10) == [1,2,3,4,5,10,9,8,7,6] # flipdim @test isequal(flipdim([2,3,1], 1), [1,3,2]) diff --git a/test/bigint.jl b/test/bigint.jl index 7d9c330f9ef64..9fa8f55d59798 100644 --- a/test/bigint.jl +++ b/test/bigint.jl @@ -33,7 +33,7 @@ ee = typemax(Int64) @test string(d) == "-246913578024691357802469135780" @test string(a) == "123456789012345678901234567890" -for i = -10:10, j = [-10:-1,1:10] +for i = -10:10, j = [-10:-1;1:10] @test div(BigInt(i), BigInt(j)) == div(i,j) @test fld(BigInt(i), BigInt(j)) == fld(i,j) @test mod(BigInt(i), BigInt(j)) == mod(i,j) diff --git a/test/blas.jl b/test/blas.jl index 20a1321fb880e..8082a2570aac7 100644 --- a/test/blas.jl +++ b/test/blas.jl @@ -12,8 +12,8 @@ for elty in (Float32, Float64, Complex64, Complex128) elm1 = convert(elty, -1) el2 = convert(elty, 2) - v14 = convert(Vector{elty}, [1:4]) - v41 = convert(Vector{elty}, [4:-1:1]) + v14 = convert(Vector{elty}, [1:4;]) + v41 = convert(Vector{elty}, [4:-1:1;]) # dot if elty <: Real diff --git a/test/combinatorics.jl b/test/combinatorics.jl index 75688d1b14481..97c3b4fb226cf 100644 --- a/test/combinatorics.jl +++ b/test/combinatorics.jl @@ -1,13 +1,13 @@ @test factorial(7) == 5040 @test factorial(7,3) == 7*6*5*4 @test binomial(5,3) == 10 -p = shuffle([1:1000]) +p = shuffle([1:1000;]) @test isperm(p) @test all(invperm(invperm(p)) .== p) push!(p, 1) @test !isperm(p) a = randcycle(10) -@test ipermute!(permute!([1:10], a),a) == [1:10] +@test ipermute!(permute!([1:10;], a),a) == [1:10;] @test collect(combinations("abc",2)) == ["ab","ac","bc"] @test collect(permutations("abc")) == ["abc","acb","bac","bca","cab","cba"] @test collect(filter(x->(iseven(x[1])),permutations([1,2,3]))) == {[2,1,3],[2,3,1]} diff --git a/test/core.jl b/test/core.jl index 8136e64291dcc..97a80faf820ae 100644 --- a/test/core.jl +++ b/test/core.jl @@ -679,15 +679,15 @@ end let tst = 1 m1(i) = (tst+=1;i-1) - x = [1:4] + x = [1:4;] x[1:end] *= 2 - @test x == [2:2:8] + @test x == [2:2:8;] x[m1(end)] += 3 @test x == [2,4,9,8] @test tst == 2 # issue #1886 - X = [1:4] + X = [1:4;] r = Array(Range1{Int},1) r[1] = 2:3 X[r...] *= 2 @@ -735,7 +735,7 @@ end # issue #2098 let - i2098() = (c={2.0};[1:1:c[1]]) + i2098() = (c={2.0};[1:1:c[1];]) @test isequal(i2098(), [1.0,2.0]) end diff --git a/test/euler.jl b/test/euler.jl index be2d4e72df881..449d085ddfd07 100644 --- a/test/euler.jl +++ b/test/euler.jl @@ -252,7 +252,7 @@ end #23: 4179871 #24: 2783915460 -@test nthperm!([0:9],1000000) == [2,7,8,3,9,1,5,4,6,0] +@test nthperm!([0:9;],1000000) == [2,7,8,3,9,1,5,4,6,0] #25: 4782 #26: 983 diff --git a/test/functional.jl b/test/functional.jl index b132ec44c702e..9fd32823288c2 100644 --- a/test/functional.jl +++ b/test/functional.jl @@ -1,7 +1,7 @@ # tests related to functional programming functions and styles # map -- array.jl -@test isequal(map((x)->"$x"[end:end], [9:11]), ["9", "0", "1"]) +@test isequal(map((x)->"$x"[end:end], 9:11), ["9", "0", "1"]) # TODO: @test map!() # map -- ranges.jl @test isequal(map(i->sqrt(i), 1:5), [sqrt(i) for i in 1:5]) @@ -23,16 +23,16 @@ end @test map((c)->char(c+1), "abcDEF") == "bcdEFG" # folds -- reduce.jl -@test foldl(-,[1:5]) == -13 -@test foldl(-,10,[1:5]) == foldl(-,[10,1:5]) +@test foldl(-,1:5) == -13 +@test foldl(-,10,1:5) == foldl(-,[10;1:5]) -@test foldr(-,[1:5]) == 3 -@test foldr(-,10,[1:5]) == foldr(-,[1:5,10]) +@test foldr(-,1:5) == 3 +@test foldr(-,10,1:5) == foldr(-,[1:5;10]) # reduce -- reduce.jl -@test reduce((x,y)->"($x+$y)", [9:11]) == "((9+10)+11)" +@test reduce((x,y)->"($x+$y)", 9:11) == "((9+10)+11)" @test reduce(max, [8 6 7 5 3 0 9]) == 9 -@test reduce(+, 1000, [1:5]) == (1000 + 1 + 2 + 3 + 4 + 5) +@test reduce(+, 1000, 1:5) == (1000 + 1 + 2 + 3 + 4 + 5) # mapreduce -- reduce.jl @test mapreduce(-, +, [-10 -9 -3]) == ((10 + 9) + 3) diff --git a/test/hashing.jl b/test/hashing.jl index 4f8e9b5f04bf1..af025814ee548 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -3,7 +3,7 @@ types = { Rational{Int8}, Rational{Uint8}, Rational{Int16}, Rational{Uint16}, Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64} } -vals = [ +vals = vcat( typemin(Int64), -integer(maxintfloat(Float64))+(-4:1), typemin(Int32), @@ -13,7 +13,7 @@ vals = [ typemax(Int32), integer(maxintfloat(Float64))+(-1:4), typemax(Int64), -] +) for T=types, S=types, x=vals a = convert(T,x) diff --git a/test/linalg.jl b/test/linalg.jl index 7ac7e3342c3cc..2b291ff47c178 100644 --- a/test/linalg.jl +++ b/test/linalg.jl @@ -485,7 +485,7 @@ for elty in (Float32, Float64, Complex64, Complex128, Int) # The determinant of a rotation matrix should always be 1. if elty != Int - for theta = convert(Vector{elty}, pi ./ [1:4]) + for theta = convert(Vector{elty}, pi ./ [1:4;]) R = [cos(theta) -sin(theta); sin(theta) cos(theta)] @test_approx_eq convert(elty, det(R)) one(elty) @@ -743,10 +743,10 @@ end # Test gradient for elty in (Int32, Int64, Float32, Float64, Complex64, Complex128) if elty <: Real - x = convert(Vector{elty}, [1:3]) + x = convert(Vector{elty}, [1:3;]) g = ones(elty, 3) else - x = convert(Vector{elty}, complex([1:3],[1:3])) + x = convert(Vector{elty}, complex([1:3;], [1:3;])) g = convert(Vector{elty}, complex(ones(3), ones(3))) end @test_approx_eq gradient(x) g diff --git a/test/numbers.jl b/test/numbers.jl index a9e3a28b0f558..9f3f2820c8e7e 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -1572,7 +1572,7 @@ approx_eq(a, b) = approx_eq(a, b, 1e-6) 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973 ] -for T in [Int,BigInt], n = [1:1000,1000000] +for T in [Int,BigInt], n = [1:1000;1000000] n = convert(T,n) f = factor(n) @test n == prod([p^k for (p,k)=f]) diff --git a/test/parallel.jl b/test/parallel.jl index 4410ebfc3e9b9..5bd873f0fb7dc 100644 --- a/test/parallel.jl +++ b/test/parallel.jl @@ -25,7 +25,7 @@ a = convert(Array, d) if nprocs() < 4 remotecall_fetch(1, () -> addprocs(4 - nprocs())) end -workloads = hist(@parallel((a,b)->[a,b], for i=1:7; myid(); end), nprocs())[2] +workloads = hist(@parallel((a,b)->[a;b], for i=1:7; myid(); end), nprocs())[2] @test maximum(workloads) - minimum(workloads) <= 1 # @parallel reduction should work even with very short ranges diff --git a/test/ranges.jl b/test/ranges.jl index 731b5bea2fbc7..c6cdf2107b562 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -17,7 +17,7 @@ L64 = linspace(int64(1), int64(4), 4) @test L32[3] == 3 && L64[3] == 3 @test L32[4] == 4 && L64[4] == 4 -r = [5:-1:1] +r = 5:-1:1 @test r[1]==5 @test r[2]==4 @test r[3]==3 diff --git a/test/sorting.jl b/test/sorting.jl index 184f83cea82d5..dd724afed5ec3 100644 --- a/test/sorting.jl +++ b/test/sorting.jl @@ -17,7 +17,7 @@ for (rg,I) in {(49:57,47:59), (1:2:17,-1:19), (-3:0.5:2,-5:.5:4), (3+0*(1:5),-5:.5:4)} rg_r = reverse(rg) - rgv, rgv_r = [rg], [rg_r] + rgv, rgv_r = [rg;], [rg_r;] for i = I @test searchsorted(rg,i) == searchsorted(rgv,i) @test searchsorted(rg_r,i,rev=true) == searchsorted(rgv_r,i,rev=true) @@ -99,7 +99,7 @@ end srand(0xdeadbeef) -for n in [0:10, 100, 101, 1000, 1001] +for n in [0:10; 100; 101; 1000; 1001] r = 1:10 v = rand(1:10,n) h = hist(v,r) diff --git a/test/statistics.jl b/test/statistics.jl index 0dc05c52486ad..93bf716b5866a 100644 --- a/test/statistics.jl +++ b/test/statistics.jl @@ -29,7 +29,7 @@ @test hist([1])[2] == [1] @test hist([1,2,3],[0,2,4]) == ([0,2,4],[2,1]) @test hist([1,2,3],0:2:4) == (0:2:4,[2,1]) -@test all(hist([1:100]/100,0.0:0.01:1.0)[2] .==1) +@test all(hist([1:100;]/100,0.0:0.01:1.0)[2] .==1) @test hist([1,1,1,1,1])[2][1] == 5 A = Complex128[exp(i*im) for i in 1:10^4] @@ -38,11 +38,11 @@ A = Complex128[exp(i*im) for i in 1:10^4] @test midpoints(1.0:1.0:10.0) == 1.5:1.0:9.5 @test midpoints(1:10) == 1.5:9.5 -@test midpoints(Float64[1.0:1.0:10.0]) == Float64[1.5:1.0:9.5] +@test midpoints(Float64[1.0:1.0:10.0;]) == Float64[1.5:1.0:9.5;] @test quantile([1,2,3,4],0.5) == 2.5 @test quantile([1., 3],[.25,.5,.75])[2] == median([1., 3]) -@test quantile([0.:100.],[.1,.2,.3,.4,.5,.6,.7,.8,.9])[1] == 10.0 +@test quantile([0.:100.;],[.1,.2,.3,.4,.5,.6,.7,.8,.9])[1] == 10.0 # Test covariance X = [1 0; 2 1; 3 0; 4 1; 5 10] diff --git a/test/suitesparse.jl b/test/suitesparse.jl index ebf2fed51ddb9..c7c90d8fb2632 100644 --- a/test/suitesparse.jl +++ b/test/suitesparse.jl @@ -17,13 +17,13 @@ L,U,p,q,Rs = lua[:(:)] b = [8., 45., -3., 3., 19.] x = lua\b -@test_approx_eq x float([1:5]) +@test_approx_eq x float([1:5;]) @test norm(A*x-b,1) < eps(1e4) b = [8., 20., 13., 6., 17.] x = lua'\b -@test_approx_eq x float([1:5]) +@test_approx_eq x float([1:5;]) @test norm(A'*x-b,1) < eps(1e4)