Skip to content

Commit

Permalink
Added testset macros to files, things are borked
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Jun 28, 2016
1 parent 1f6a43f commit 912d83f
Show file tree
Hide file tree
Showing 153 changed files with 462 additions and 203 deletions.
3 changes: 3 additions & 0 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "abstractarray" begin
# Bounds checking
A = rand(3,3,3)
@test checkbounds(Bool, A, 1, 1, 1) == true
Expand Down Expand Up @@ -629,3 +630,5 @@ let
@test !issparse(m1)
@test !issparse(m2)
end

end
2 changes: 2 additions & 0 deletions test/ambiguous.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "ambiguous" begin
# DO NOT ALTER ORDER OR SPACING OF METHODS BELOW
const lineoffset = @__LINE__ + 0 # XXX: __LINE__ at the end of a line is off-by-one
ambig(x, y) = 1
Expand Down Expand Up @@ -170,3 +171,4 @@ let ms = methods(g16493, (Complex, Any))
end

nothing
end
3 changes: 3 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "arrayops" begin
#Array test

## basics
Expand Down Expand Up @@ -1662,3 +1663,5 @@ let A = zeros(3,3)
@test size(A[:,UInt(1):UInt(2)]) == (3,2)
@test size(similar(A, UInt(3), 0x3)) == size(similar(A, (UInt(3), 0x3))) == (3,3)
end

end
3 changes: 2 additions & 1 deletion test/backtrace.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "backtrace" begin
bt = backtrace()
have_backtrace = false
for l in bt
Expand Down Expand Up @@ -96,3 +96,4 @@ let
@test i1 > 0 && i2 > 0
@test b1[i1].line != b2[i2].line
end
end
4 changes: 3 additions & 1 deletion test/base64.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "base64" begin
const inputText = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."
const encodedMaxLine76 =
"""TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
Expand Down Expand Up @@ -41,3 +41,5 @@ ipipe = Base64DecodePipe(IOBuffer(string(encodedMaxLine76[1:end-2],"==")))
# Test incorrect format
ipipe = Base64DecodePipe(IOBuffer(encodedMaxLine76[1:end-3]))
@test_throws ArgumentError readstring(ipipe)

end
2 changes: 2 additions & 0 deletions test/bigfloat.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "bigfloat" begin
@test big(2.0)^big(3) == 8

for T in [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt]
Expand All @@ -9,3 +10,4 @@ end

# issue 15659
@test (setprecision(53) do; big(1/3); end) < 1//3
end
2 changes: 2 additions & 0 deletions test/bigint.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "bigint" begin
a = parse(BigInt,"123456789012345678901234567890")
b = parse(BigInt,"123456789012345678901234567891")

Expand Down Expand Up @@ -311,3 +312,4 @@ ndigits(rand(big(-999:999)), big(2)^rand(2:999))

@test big(5)^true == big(5)
@test big(5)^false == one(BigInt)
end
5 changes: 3 additions & 2 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

using Base.Test

@testset "bitarray" begin
tc{N}(r1::NTuple{N}, r2::NTuple{N}) = all(x->tc(x...), [zip(r1,r2)...])
tc{N}(r1::BitArray{N}, r2::Union{BitArray{N},Array{Bool,N}}) = true
tc{T}(r1::T, r2::T) = true
Expand Down Expand Up @@ -1354,3 +1353,5 @@ B = trues(Int64(10))
A = falses(Int32(10))
B = falses(Int64(10))
@test A == B

end
3 changes: 3 additions & 0 deletions test/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Base.LinAlg, Base.LinAlg.BlasReal, Base.LinAlg.BlasComplex

@testset "blas" begin
srand(100)
# syr2k! and her2k!
for elty in (Float32, Float64, Complex64, Complex128)
Expand Down Expand Up @@ -295,3 +296,5 @@ for elty in [Float32, Float64, Complex64, Complex128]
@test_throws DimensionMismatch BLAS.syrk!('L','N',one(elty),eye(elty,5),one(elty),eye(elty,6))
end
end

end
4 changes: 3 additions & 1 deletion test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module TestBroadcastInternals

using Base.Broadcast: broadcast_shape, check_broadcast_shape, newindex, _bcs, _bcsm
using Base.Test

@testset "broadcast" begin
@test @inferred(_bcs((), (3,5), (3,5))) == (3,5)
@test @inferred(_bcs((), (3,1), (3,5))) == (3,5)
@test @inferred(_bcs((), (3,), (3,5))) == (3,5)
Expand Down Expand Up @@ -196,3 +196,5 @@ end
let a = broadcast(Float32, [3, 4, 5])
@test eltype(a) == Float32
end

end
3 changes: 3 additions & 0 deletions test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Base.copy, Base.==

@testset "ccall" begin
const libccalltest = "libccalltest"

const verbose = false
Expand Down Expand Up @@ -713,3 +714,5 @@ elseif Sys.ARCH === :aarch64
@test res === expected
end
end

end
4 changes: 2 additions & 2 deletions test/char.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

#tests for /base/char.jl

@testset "char" begin
@test typemin(Char) == Char(0)
@test ndims(Char) == 0
@test getindex('a', 1) == 'a'
Expand Down Expand Up @@ -195,3 +194,4 @@ let
end

@test !isequal('x', 120)
end
4 changes: 2 additions & 2 deletions test/checked.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

# Checked integer arithmetic

import Base: checked_abs, checked_neg, checked_add, checked_sub, checked_mul,
checked_div, checked_rem, checked_fld, checked_mod, checked_cld

@testset "checked" begin
# checked operations

for T in (Int8, Int16, Int32, Int64, Int128)
Expand Down Expand Up @@ -253,3 +252,4 @@ end

@test checked_mul(UInt128(3), UInt128(4)) === UInt128(12)
@test_throws OverflowError checked_mul(UInt128(2)^127, UInt128(2))
end
3 changes: 3 additions & 0 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "cmdlineargs" begin
let exename = `$(Base.julia_cmd()) --precompiled=yes`
# --version
let v = split(readstring(`$exename -v`), "julia version ")[end]
Expand Down Expand Up @@ -280,3 +281,5 @@ let exename = `$(Base.julia_cmd())`
@test readchomp(`$exename --precompiled=yes -E "Bool(Base.JLOptions().use_precompiled)"`) == "true"
@test readchomp(`$exename --precompiled=no -E "Bool(Base.JLOptions().use_precompiled)"`) == "false"
end

end
2 changes: 2 additions & 0 deletions test/combinatorics.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "combinatorics" begin
@test binomial(5,-1) == 0
@test binomial(5,10) == 0
@test binomial(5,3) == 10
Expand Down Expand Up @@ -62,3 +63,4 @@ if Int === Int32
@test factorial(Int32(12)) === Int32(479001600)
@test_throws OverflowError factorial(Int32(13))
end
end
4 changes: 2 additions & 2 deletions test/compile.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

using Base.Test

@testset "compile" begin
function redirected_stderr()
rd, wr = redirect_stderr()
@async readstring(rd) # make sure the kernel isn't being forced to buffer the output
Expand Down Expand Up @@ -233,3 +232,4 @@ let module_name = string("a",randstring())
deleteat!(LOAD_PATH,1)
rm(file_name)
end
end
2 changes: 2 additions & 0 deletions test/complex.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "complex" begin
@test reim(2 + 3im) == (2, 3)

for T in (Int64, Float64)
Expand Down Expand Up @@ -914,3 +915,4 @@ let x = 1+im
@inferred sin(x)
@inferred cos(x)
end
end
2 changes: 2 additions & 0 deletions test/copy.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "copy" begin
mainres = ([4, 5, 3],
[1, 5, 3])
bitres = ([true, true, false],
Expand Down Expand Up @@ -108,3 +109,4 @@ let x = BigFloat[1:1000;], y, z, v
# Check that the setprecision indeed does something
@test z != x
end
end
2 changes: 2 additions & 0 deletions test/datafmt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "datafmt" begin
# countlines
@test countlines(IOBuffer("\n")) == 1
@test countlines(IOBuffer("\n"),'\r') == 0
Expand Down Expand Up @@ -262,3 +263,4 @@ for writefunc in ((io,x) -> show(io, "text/csv", x),
@test vec(readcsv(io)) == x
end
end
end
4 changes: 2 additions & 2 deletions test/dates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module TestDates

using Base.Dates
using Base.Test

@testset "dates" begin
include("dates/types.jl")
include("dates/periods.jl")
include("dates/accessors.jl")
Expand All @@ -14,5 +14,5 @@ include("dates/conversions.jl")
include("dates/ranges.jl")
include("dates/adjusters.jl")
include("dates/io.jl")

end
end
3 changes: 3 additions & 0 deletions test/dates/accessors.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "accessors" begin
# yearmonthday is the opposite of totaldays
# taking Rata Die Day # and returning proleptic Gregorian date
@test Dates.yearmonthday(-306) == (0,2,29)
Expand Down Expand Up @@ -193,3 +194,5 @@ dr = [a,a,a,a,a,a,a,a,a,a]
@test Dates.minute(dr) == repmat([0],10)
@test Dates.second(dr) == repmat([0],10)
@test Dates.millisecond(dr) == repmat([0],10)

end
3 changes: 3 additions & 0 deletions test/dates/adjusters.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "adjustors" begin
#trunc
dt = Dates.Date(2012,12,21)
@test trunc(dt,Dates.Year) == Dates.Date(2012)
Expand Down Expand Up @@ -458,3 +459,5 @@ end) == 251
end
return sum == 15
end) == 15 # On average, there's one of those months every year

end
3 changes: 3 additions & 0 deletions test/dates/arithmetic.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "arithmetic" begin
# DateTime arithmetic
a = Dates.DateTime(2013,1,1,0,0,0,1)
b = Dates.DateTime(2013,1,1,0,0,0,0)
Expand Down Expand Up @@ -388,3 +389,5 @@ t4 = [DateTime(2009,1,1,0,0,1), DateTime(2009,1,2,0,1), DateTime(2009,1,3,1)]
@test t4 - t3 == [Millisecond(1000), Millisecond(60000), Millisecond(3600000)]
@test (Date(2009,1,1):Week(1):Date(2009,1,21)) - (Date(2009,1,1):Day(1):Date(2009,1,3)) == [0d, 6d, 12d]
@test (DateTime(2009,1,1,1,1,1):Second(1):DateTime(2009,1,1,1,1,3)) - (DateTime(2009,1,1,1,1):Second(1):DateTime(2009,1,1,1,1,2)) == [1s, 1s, 1s]

end
3 changes: 3 additions & 0 deletions test/dates/conversions.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "conversions" begin
# Test conversion to and from unix
@test Dates.unix2datetime(Dates.datetime2unix(DateTime(2000,1,1))) == DateTime(2000,1,1)
@test Dates.value(Dates.DateTime(1970)) == Dates.UNIXEPOCH
Expand Down Expand Up @@ -102,3 +103,5 @@ b = Dates.Date(2000)
@test convert(Date,730120) == b
@test convert(Date,730120.0) == b
@test convert(Date,Int32(730120)) == b

end
2 changes: 2 additions & 0 deletions test/dates/io.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "io" begin
# Test string/show representation of Date
@test string(Dates.Date(1,1,1)) == "0001-01-01" # January 1st, 1 AD/CE
@test sprint(show, Dates.Date(1,1,1)) == "0001-01-01"
Expand Down Expand Up @@ -359,3 +360,4 @@ let
@test DateTime(ds, format) == dt
@test DateTime(ds, escaped_format) == dt
end
end
3 changes: 3 additions & 0 deletions test/dates/periods.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "periods" begin
# Period testing
@test -Dates.Year(1) == Dates.Year(-1)
@test Dates.Year(1) > Dates.Year(0)
Expand Down Expand Up @@ -380,3 +381,5 @@ cpa = [1y+1s 1m+1s 1w+1s 1d+1s; 1h+1s 1mi+1s 2m+1s 1s+1ms]

@test [1y+1s 1m+1s; 1w+1s 1d+1s] + [1y+1h 1y+1mi; 1y+1s 1y+1ms] == [2y+1h+1s 1y+1m+1mi+1s; 1y+1w+2s 1y+1d+1s+1ms]
@test [1y+1s 1m+1s; 1w+1s 1d+1s] - [1y+1h 1y+1mi; 1y+1s 1y+1ms] == [1s-1h 1m+1s-1y-1mi; 1w-1y 1d+1s-1y-1ms]

end
3 changes: 3 additions & 0 deletions test/dates/query.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "query" begin
# Name functions
jan = Dates.DateTime(2013,1,1) #Tuesday
feb = Dates.DateTime(2013,2,2) #Saturday
Expand Down Expand Up @@ -197,3 +198,5 @@ end
@test Dates.dayofquarter(Dates.DateTime(2014,6,30)) == 91
@test Dates.dayofquarter(Dates.DateTime(2014,9,30)) == 92
@test Dates.dayofquarter(Dates.DateTime(2014,12,31)) == 92

end
2 changes: 2 additions & 0 deletions test/dates/ranges.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "ranges" begin
function test_all_combos()
for T in (Dates.Date,Dates.DateTime)
f1 = T(2014); l1 = T(2013,12,31)
Expand Down Expand Up @@ -499,3 +500,4 @@ let d = Dates.Day(1)
@test (Dates.Date(2000):d:Dates.Date(2001))+d == (Dates.Date(2000)+d:d:Dates.Date(2001)+d)
@test (Dates.Date(2000):d:Dates.Date(2001))-d == (Dates.Date(2000)-d:d:Dates.Date(2001)-d)
end
end
3 changes: 3 additions & 0 deletions test/dates/types.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "types" begin
# Date internal algorithms
@test Dates.totaldays(0,2,28) == -307
@test Dates.totaldays(0,2,29) == -306
Expand Down Expand Up @@ -171,3 +172,5 @@ ms = Dates.Millisecond(1)

@test isfinite(Dates.Date)
@test isfinite(Dates.DateTime)

end
2 changes: 2 additions & 0 deletions test/dict.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@testset "dict" begin
# Pair
p = Pair(1,2)
@test p == (1=>2)
Expand Down Expand Up @@ -550,3 +551,4 @@ let badKeys = UInt16[0xb800,0xa501,0xcdff,0x6303,0xe40a,0xcf0e,0xf3df,0xae99,0x9
end
end
end
end
Loading

0 comments on commit 912d83f

Please sign in to comment.