Skip to content

Commit

Permalink
extend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Expander committed Oct 6, 2023
1 parent 5d67605 commit b8c2e75
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/Li.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ end
@test PolyLog.li(n, Float16(1.0)) zeta
@test PolyLog.li(n, 1//1) zeta
@test PolyLog.li(n, 1) zeta
@test PolyLog.li(n, BigFloat("1.0")) == PolyLog.zeta(n, BigFloat)

@test PolyLog.li(n, 1.0 + 0.0im) == zeta
@test PolyLog.li(n, 1.0f0 + 0.0f0im) zeta
@test PolyLog.li(n, ComplexF16(1.0 + 0.0im)) zeta
@test PolyLog.li(n, 1//1 + 0//1im) zeta
@test PolyLog.li(n, 1 + 0im) zeta
@test PolyLog.li(n, BigFloat("1.0") + 0im) == PolyLog.zeta(n, BigFloat)
end

# value close to boundary between series 1 and 2 in arXiv:2010.09860
@test PolyLog.li(-2, -0.50001) -0.074072592582716422 atol=1e-14
@test PolyLog.reli(-2, -0.50001) -0.074072592582716422 atol=1e-14
@test PolyLog.li(-2, -0.50001) -0.074072592582716422 atol=1e-14
@test PolyLog.reli(-2, -0.50001) -0.074072592582716422 atol=1e-14
@test PolyLog.li(-2, BigFloat("-0.50001")) -0.074072592582716422 atol=1e-14
@test PolyLog.reli(-2, BigFloat("-0.50001")) -0.074072592582716422 atol=1e-14

# value sensitive to proper treatment of 0.0 vs -0.0 in imag(z)
Expand All @@ -86,12 +89,15 @@ end
@test isinf(PolyLog.reli(10, Inf))
@test isinf(PolyLog.reli(10, BigFloat(Inf)))
@test isnan(PolyLog.li(10, NaN))
@test isnan(PolyLog.li(10, BigFloat(NaN)))
@test isinf(PolyLog.li(10, Inf))
@test isinf(PolyLog.li(10, BigFloat(Inf)))

# test type stability
for T in (Float16, Float32, Float64, BigFloat)
for n in -10:10
for x in (NaN, Inf, -2, -1, 0, 1, 2, 3)
@test typeof(PolyLog.li(n, convert(Complex{T}, x))) == Complex{T}
@test typeof(PolyLog.reli(n, convert(T, x))) == T
end
end
Expand Down

0 comments on commit b8c2e75

Please sign in to comment.