Skip to content

Commit a85fd7c

Browse files
committed
restore Singularities tests with timings to find slow ones
1 parent c979a70 commit a85fd7c

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

test/FullSingularitiesTest.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@testset "Full Singularities Tests" begin
2+
@time @test norm(Fun(exp,Legendre(0..1))+sqrt(Fun(0..1))) 2.491141949903508
3+
end
4+

test/SingularitiesTest.jl

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
55
@testset "Singularities" begin
66
@testset "sqrt" begin
77
x=Fun(identity);
8-
@test sqrt(cos/2*x))(.1) sqrt(cos(.1π/2))
8+
@time @test sqrt(cos/2*x))(.1) sqrt(cos(.1π/2))
99

1010
x=Fun(identity,-2..2)
11-
u=sqrt(4-x^2)/(2π)
11+
@time u=sqrt(4-x^2)/(2π)
1212

1313
@test u(.1) sqrt(4-0.1^2)/(2π)
1414
@test sum(u) 1
@@ -25,19 +25,18 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
2525
@test (x/u)(.1) tan*.1/2)
2626

2727
f=Fun(x->exp(-x^2),Line(0.,0.,-.5,-.5),400)
28-
@test sum(f) sqrt(π)
28+
@time @test sum(f) sqrt(π)
2929

3030
f=Fun(x->exp(x)/sqrt(1-x.^2),JacobiWeight(-.5,-.5))
3131
@test f(.1) (x->exp(x)/sqrt(1-x.^2))(.1)
3232

33-
@test norm(Fun(exp,Legendre(0..1))+sqrt(Fun(0..1))) 2.491141949903508
34-
35-
# sampling Chebyshev
36-
x=Fun(identity)
37-
f = exp(x)/sqrt(1-x^2)
38-
g = cumsum(f)
39-
@test abs(g(-1)) 1E-15
40-
@test g'(0.1) f(0.1)
33+
@testset "sampling Chebyshev" begin
34+
x=Fun(identity)
35+
f = exp(x)/sqrt(1-x^2)
36+
@time g = cumsum(f)
37+
@test abs(g(-1)) 1E-15
38+
@test g'(0.1) f(0.1)
39+
end
4140
end
4241

4342
@testset "JacobiWeight Derivative" begin
@@ -72,10 +71,7 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
7271
f = exp(x)/(1-x.^2).^1.0
7372
@test f(.1) exp(.1)/(1-.1^2)
7473

75-
76-
7774
## 1/f with poles
78-
7975
x=Fun(identity)
8076
f=sin(10x)
8177
g=1/f
@@ -105,9 +101,9 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
105101
@test Line() Ray() == Ray()
106102

107103
f=Fun(sech,Line())
108-
Fun(f,Ray())(2.0) sech(2.0)
109-
Fun(f,Ray(0.,π))(-2.0) sech(-2.0)
110-
Fun(sech,Ray(0.,π))(-2.0) sech(-2.0)
104+
@test Fun(f,Ray())(2.0) sech(2.0)
105+
@test Fun(f,Ray(0.,π))(-2.0) sech(-2.0)
106+
@test Fun(sech,Ray(0.,π))(-2.0) sech(-2.0)
111107
end
112108

113109
@testset "Ei (Exp Integral)" begin
@@ -186,8 +182,8 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
186182
δ=DiracDelta()
187183
x=Fun()
188184
w=sqrt(1-x^2)
189-
w+δ
190-
185+
@test (w+δ)(0.1) w(0.1)
186+
@test sum(w+δ) sum(w)+1
191187

192188
## PointSpace
193189

@@ -254,16 +250,16 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
254250
@test (1/x^2)(-0.1) 100.
255251

256252
fc=x*(1+x)^2
257-
@test (1/fc)(0.1) 1/fc(0.1)
253+
@time @test (1/fc)(0.1) 1/fc(0.1)
258254

259255
fc=x*(1-x)^2
260256
@test (1/fc)(0.1) 1/fc(0.1)
261257
end
262258

263259
@testset "special function singularities" begin
264260
x=Fun(0..1)
265-
@test erf(sqrt(x))(0.1) erf(sqrt(0.1))
266-
@test erfc(sqrt(x))(0.1) erfc(sqrt(0.1))
261+
@time @test erf(sqrt(x))(0.1) erf(sqrt(0.1))
262+
@time @test erfc(sqrt(x))(0.1) erfc(sqrt(0.1))
267263

268264
## roots of log(abs(x-y))
269265
x=Fun(-2..(-1))
@@ -289,7 +285,7 @@ using ApproxFun, IntervalSets, SpecialFunctions, LinearAlgebra, Random, Test
289285

290286
@testset "#393" begin
291287
x = Fun(0..1)
292-
f = exp(x)*sqrt(x)*log(1-x)
288+
@time f = exp(x)*sqrt(x)*log(1-x)
293289
@test f(0.1) exp(0.1)*sqrt(0.1)*log(1-0.1)
294290
end
295291

test/fulltests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using ApproxFun, LinearAlgebra, SpecialFunctions, FastTransforms, Test
55

66

77
include("runtests.jl")
8-
@time include("SingularitiesTest.jl")
8+
@time include("FullSingularitiesTest.jl")
99
@time include("SpacesTest.jl")
1010

1111

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ end
7474
@time include("JacobiTest.jl")
7575
@time include("LaguerreTest.jl")
7676
@time include("HermiteTest.jl")
77+
@time include("SingularitiesTest.jl")
7778
@time include("ETDRK4Test.jl")
7879
@time include("MultivariateTest.jl")
7980
@time include("PDETest.jl")

0 commit comments

Comments
 (0)