Skip to content

Commit

Permalink
move missing definitions and tests to separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
Expander committed Dec 2, 2024
1 parent 37f6933 commit 91a6deb
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 47 deletions.
4 changes: 0 additions & 4 deletions src/Li.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ function _reli(n::Integer, x::Real)
end
end

reli(::Integer, ::Missing) = missing

"""
li(n::Integer, z::Complex)
Expand Down Expand Up @@ -161,8 +159,6 @@ function _li(n::Integer, z::Complex{T})::Complex{T} where T
end
end

li(::Integer, ::Missing) = missing

# returns -(-1)^n of type T
function oddsgn(n, ::Type{T})::T where T
isodd(n) ? one(T) : -one(T)
Expand Down
2 changes: 0 additions & 2 deletions src/Li0.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ function li0(z::Number)
z/(1 - z)
end
end

li0(::Missing) = missing
4 changes: 0 additions & 4 deletions src/Li1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function reli1(x::Real)
end
end

reli1(::Missing) = missing

"""
li1(z::Complex)
Expand Down Expand Up @@ -68,5 +66,3 @@ function li1(z::Complex)
end

li1(z::Real) = li1(Complex(z))

li1(::Missing) = missing
4 changes: 0 additions & 4 deletions src/Li2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ function _reli2(x::T)::T where T
end
end

reli2(::Missing) = missing


"""
li2(z::Complex)
Expand Down Expand Up @@ -303,5 +301,3 @@ function _li2(z::Complex{BigFloat})::Complex{BigFloat}
end
end
end

li2(::Missing) = missing
4 changes: 0 additions & 4 deletions src/Li3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ function _reli3(x::Float64)::Float64
end
end

reli3(::Missing) = missing

"""
li3(z::Complex)
Expand Down Expand Up @@ -202,5 +200,3 @@ function _li3(z::ComplexF64)::ComplexF64
end
end
end

li3(::Missing) = missing
4 changes: 0 additions & 4 deletions src/Li4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ function _reli4(x::Float64)::Float64
end
end

reli4(::Missing) = missing

"""
li4(z::Complex)
Expand Down Expand Up @@ -246,5 +244,3 @@ function _li4(z::ComplexF64)::ComplexF64
end
end
end

li4(::Missing) = missing
2 changes: 0 additions & 2 deletions src/Li5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,3 @@ function _li5(z::ComplexF64)::ComplexF64
u8*u8*(B[16] + u*B[17] + u2*(B[18] + u*B[19]))
end
end

li5(::Missing) = missing
2 changes: 0 additions & 2 deletions src/Li6.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,3 @@ function _li6(z::ComplexF64)::ComplexF64
)
end
end

li6(::Missing) = missing
7 changes: 7 additions & 0 deletions src/Missing.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for f in (:li0, :li1, :li2, :li3, :li4, :li5, :li6, :reli1, :reli2, :reli3, :reli4)
@eval $(f)(::Missing) = missing
end

for f in (:li, :reli)
@eval $(f)(::Integer, ::Missing) = missing
end
1 change: 1 addition & 0 deletions src/PolyLog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ include("Li5.jl")
include("Li6.jl")
include("Li.jl")
include("Log.jl")
include("Missing.jl")
include("Types.jl")
include("Zeta.jl")

Expand Down
3 changes: 0 additions & 3 deletions test/Li.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ end
for ni in nis
n = ni.n

@test ismissing(PolyLog.li(n, missing))
@test ismissing(PolyLog.reli(n, missing))

complex_data = read_from(joinpath(@__DIR__, "data", "Li$(n).txt"), BigFloat)
real_data = filter_real(complex_data)

Expand Down
2 changes: 0 additions & 2 deletions test/Li0.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@testset "li0" begin
@test ismissing(PolyLog.li0(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li0.txt"), BigFloat)
real_data = filter_real(cmpl_data)

Expand Down
3 changes: 0 additions & 3 deletions test/Li1.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@testset "li1" begin
@test ismissing(PolyLog.li1(missing))
@test ismissing(PolyLog.reli1(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li1.txt"), BigFloat)
real_data = filter_real(cmpl_data)

Expand Down
3 changes: 0 additions & 3 deletions test/Li2.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@testset "li2" begin
@test ismissing(PolyLog.li2(missing))
@test ismissing(PolyLog.reli2(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li2.txt"), BigFloat)
real_data = filter_real(cmpl_data)

Expand Down
3 changes: 0 additions & 3 deletions test/Li3.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@testset "li3" begin
@test ismissing(PolyLog.li3(missing))
@test ismissing(PolyLog.reli3(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li3.txt"), BigFloat)
real_data = filter_real(cmpl_data)

Expand Down
3 changes: 0 additions & 3 deletions test/Li4.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@testset "li4" begin
@test ismissing(PolyLog.li4(missing))
@test ismissing(PolyLog.reli4(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li4.txt"), BigFloat)
real_data = filter_real(cmpl_data)

Expand Down
2 changes: 0 additions & 2 deletions test/Li5.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@testset "li5" begin
@test ismissing(PolyLog.li5(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li5.txt"), BigFloat)

test_function_on_data(PolyLog.li5, map(ComplexF64, cmpl_data), 1e-14, 1e-14)
Expand Down
2 changes: 0 additions & 2 deletions test/Li6.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@testset "li6" begin
@test ismissing(PolyLog.li6(missing))

cmpl_data = read_from(joinpath(@__DIR__, "data", "Li6.txt"), BigFloat)

test_function_on_data(PolyLog.li6, map(ComplexF64, cmpl_data), 1e-14, 1e-14)
Expand Down
19 changes: 19 additions & 0 deletions test/Missing.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@testset "Missing" begin
@test ismissing(PolyLog.li0(missing))
@test ismissing(PolyLog.li1(missing))
@test ismissing(PolyLog.li2(missing))
@test ismissing(PolyLog.li3(missing))
@test ismissing(PolyLog.li4(missing))
@test ismissing(PolyLog.li5(missing))
@test ismissing(PolyLog.li6(missing))

@test ismissing(PolyLog.reli1(missing))
@test ismissing(PolyLog.reli2(missing))
@test ismissing(PolyLog.reli3(missing))
@test ismissing(PolyLog.reli4(missing))

for n in -16:16
@test ismissing(PolyLog.li(n, missing))
@test ismissing(PolyLog.reli(n, missing))
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ include("Li5.jl")
include("Li6.jl")
include("Li.jl")
include("Log.jl")
include("Missing.jl")
include("Zeta.jl")

0 comments on commit 91a6deb

Please sign in to comment.