-
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathruntests.jl
More file actions
59 lines (49 loc) · 1.43 KB
/
runtests.jl
File metadata and controls
59 lines (49 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This file contains code that was formerly a part of Julia. License is MIT: http://julialang.org/license
using SpecialFunctions
using ChainRulesCore
using ChainRulesTestUtils
using Random
using Test
using Base.MathConstants: γ
using Aqua: Aqua
using ExplicitImports: ExplicitImports
using SpecialFunctions: AmosException, f64
# useful test functions for relative error, which differ from isapprox
# relerr separately looks at the real and imaginary parts if one of the arguments is complex
relerr(z, x) = z == x ? zero(z) : abs(z - x) / abs(x)
relerr(z::T, x::T) where {T <: Complex} = max(relerr(real(z),real(x)), relerr(imag(z),imag(x)))
relerr(z::Complex, x) = relerr(z, Complex(x))
relerr(z, x::Complex) = relerr(Complex(z), x)
checktol(err::Float16) = err ≤ 5e-2
checktol(err::Float32) = err ≤ 1e-6
checktol(err::Float64) = err ≤ 1e-13
≅(a,b) = checktol(relerr(a,b))
tests = [
"bessel",
"beta_inc",
"betanc",
"ellip",
"erf",
"expint",
"gamma_inc",
"gamma",
"logabsgamma",
"sincosint",
"other_tests",
"chainrules",
"qa"
]
const testdir = dirname(@__FILE__)
for t in tests
tp = joinpath(testdir, "$(t).jl")
@testset "$(t)" begin
include(tp)
end
end
# Update this condition when JET support new version
# https://github.com/aviatesk/JET.jl/blob/master/Project.toml
if VERSION < v"1.13"
@testset "JET" begin
include(joinpath(testdir, "jet.jl"))
end
end