Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins committed Sep 4, 2018
1 parent 4f9028c commit b7d48b9
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions stdlib/Statistics/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,17 @@ end
@test mean(skipmissing([1, missing, 2])) === 1.5
@test isequal(mean(Complex{Float64}[]), NaN+NaN*im)
@test isequal(mean(skipmissing(Complex{Float64}[])), NaN+NaN*im)
@test mean(Complex{Float64}[]) isa Complex{Float64}
@test mean(skipmissing(Complex{Float64}[])) isa Complex{Float64}
@test isequal(mean(abs, Complex{Float64}[]), NaN)
@test isequal(mean(abs, skipmissing(Complex{Float64}[])), NaN)
@test mean(abs, Complex{Float64}[]) isa Float64
@test mean(abs, skipmissing(Complex{Float64}[])) isa Float64
@test_throws MethodError mean([])
@test_throws MethodError mean(skipmissing([]))
@test_throws MethodError mean((1 for i in 2:1))
@test mean(Int[]) isa Float64
@test mean(skipmissing(Int[])) isa Float64

# Check that small types are accumulated using wider type
for T in (Int8, UInt8)
Expand Down Expand Up @@ -250,8 +259,15 @@ end
@test f(skipmissing([1, missing, 2]), 0) === f([1, 2], 0)
end

@test isequal(mean(Complex{Float64}[]), NaN)
@test isequal(mean(skipmissing(Complex{Float64}[])), NaN)
@test isequal(var(Complex{Float64}[]), NaN)
@test isequal(var(skipmissing(Complex{Float64}[])), NaN)
@test var(Complex{Float64}[]) isa Float64
@test var(skipmissing(Complex{Float64}[])) isa Float64
@test_throws MethodError var([])
@test_throws MethodError var(skipmissing([]))
@test_throws MethodError var((1 for i in 2:1))
@test var(Int[]) isa Float64
@test var(skipmissing(Int[])) isa Float64
end

function safe_cov(x, y, zm::Bool, cr::Bool)
Expand Down

0 comments on commit b7d48b9

Please sign in to comment.