Skip to content

Commit 27444b7

Browse files
authored
verbose testset reporting (#131)
1 parent 6cc83c9 commit 27444b7

File tree

10 files changed

+52
-42
lines changed

10 files changed

+52
-42
lines changed

test/ChebyshevTest.jl

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@ import ApproxFunBase: recA, recB, recC, transform!, itransform!
33
import ApproxFunBaseTest: testspace
44
import ApproxFunOrthogonalPolynomials: forwardrecurrence
55

6-
@testset "Chebyshev" begin
6+
@verbose @testset "Chebyshev" begin
77
@testset "Forward recurrence" begin
88
@test forwardrecurrence(Float64,Chebyshev(),0:9,1.0) == ones(10)
99
end
1010

1111
@testset "ChebyshevInterval" begin
12-
@test @inferred Fun(x->2,10)(.1) 2
13-
@test @inferred Fun(x->2)(.1) 2
14-
@test @inferred Fun(Chebyshev,Float64[]).([0.,1.]) [0.,0.]
15-
@test @inferred Fun(Chebyshev,[])(0.) 0.
16-
@test @inferred Fun(x->4,Chebyshev(),1).coefficients == [4.0]
17-
@test @inferred Fun(x->4).coefficients == [4.0]
18-
@test @inferred Fun(4).coefficients == [4.0]
19-
20-
21-
@test @inferred Fun(x->4).coefficients == [4.0]
22-
@test @inferred Fun(4).coefficients == [4.0]
12+
@test @inferred(Fun(x->2,10))(.1) 2
13+
@test Fun(x->2)(.1) 2
14+
@test @inferred(Fun(Chebyshev, Float64[])).([0.,1.]) [0.,0.]
15+
@test Fun(Chebyshev, [])(0.) 0.
16+
@test @inferred(Fun(x->4, Chebyshev(), 1)).coefficients == [4.0]
17+
@test Fun(x->4).coefficients == [4.0]
18+
@test @inferred(Fun(4)).coefficients == [4.0]
2319

2420
f = @inferred Fun(ChebyshevInterval(), [1])
2521
@test f(0.1) == 1
@@ -61,8 +57,8 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
6157

6258
r=2 .* rand(100) .- 1
6359

64-
@test @inferred maximum(abs,ef.(r)-exp.(r))<200eps()
65-
@test @inferred maximum(abs,ecf.(r).-cos.(r).*exp.(r))<200eps()
60+
@test @inferred(maximum(abs,ef.(r)-exp.(r))) < 200eps()
61+
@test @inferred(maximum(abs,ecf.(r).-cos.(r).*exp.(r))) < 200eps()
6662

6763
@test (@inferred (cf .* ef)(0.1)) ecf(0.1) cos(0.1)*exp(0.1)
6864
@test (@inferred domain(cf.*ef)) domain(ecf)
@@ -108,8 +104,8 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
108104
ef = Fun(exp,1..2)
109105
cf = Fun(cos,1..2)
110106

111-
ecf = Fun(x->cos(x).*exp(x),1..2)
112-
eocf = Fun(x->cos(x)./exp(x),1..2)
107+
ecf = Fun(x->cos(x)*exp(x),1..2)
108+
eocf = Fun(x->cos(x)/exp(x),1..2)
113109

114110
r=rand(100) .+ 1
115111
x=1.5
@@ -216,16 +212,16 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
216212
end
217213

218214
@testset "inplace transform" begin
219-
@testset for T in [Float32, Float64], ET in Any[T, complex(T)]
220-
v = Array{ET}(undef, 10)
215+
@testset for T in (Float32, Float64), ET in (T, complex(T))
216+
v = Array{ET}(undef, 6)
221217
v2 = similar(v)
222-
M = Array{ET}(undef, 10, 10)
218+
M = Array{ET}(undef, 6, 6)
223219
M2 = similar(M)
224-
A = Array{ET}(undef, 10, 10, 10)
220+
A = Array{ET}(undef, 6, 6, 6)
225221
A2 = similar(A)
226-
@testset for d in Any[(), (0..1,)]
222+
@testset for d in ((), (0..1,))
227223
C = Chebyshev(d...)
228-
Slist = Any[C, NormalizedPolynomialSpace(C)]
224+
Slist = (C, NormalizedPolynomialSpace(C))
229225
@testset for S in Slist
230226
test_transform!(v, v2, S)
231227
end

test/JacobiTest.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using ApproxFunBaseTest: testbandedbelowoperator, testbandedoperator, testspace,
55
testfunctional
66
import ApproxFunOrthogonalPolynomials: jacobip
77

8-
@testset "Jacobi" begin
8+
@verbose @testset "Jacobi" begin
99
@testset "Basic" begin
1010
@test jacobip(0:5,2,0.5,0.1) [1.,0.975,-0.28031249999999996,-0.8636328125,-0.0022111816406250743,0.7397117980957031]
1111

@@ -43,21 +43,21 @@ import ApproxFunOrthogonalPolynomials: jacobip
4343
@test norm(Fun(Fun(exp),Jacobi(-.5,-.5))-Fun(exp,Jacobi(-.5,-.5))) < 300eps()
4444

4545
@testset "inplace transform" begin
46-
@testset for T in [Float32, Float64], ET in Any[T, complex(T)]
46+
@testset for T in (Float32, Float64), ET in (T, complex(T))
4747
v = Array{ET}(undef, 10)
4848
v2 = similar(v)
49-
@testset for a in 0:0.5:3, b in 0:0.5:3, d in Any[(), (0..1,)]
49+
@testset for a in 0:0.5:3, b in 0:0.5:3, d in ((), (0..1,))
5050
J = Jacobi(a, b, d...)
51-
Slist = Any[J, NormalizedPolynomialSpace(J)]
51+
Slist = (J, NormalizedPolynomialSpace(J))
5252
@testset for S in Slist
5353
test_transform!(v, v2, S)
5454
end
5555
end
5656
v = Array{ET}(undef, 10, 10)
5757
v2 = similar(v)
58-
@testset for a in 0:0.5:3, b in 0:0.5:3, d in Any[(), (0..1,)]
58+
@testset for a in 0:0.5:3, b in 0:0.5:3, d in ((), (0..1,))
5959
J = Jacobi(a, b, d...)
60-
Slist = Any[J, NormalizedPolynomialSpace(J)]
60+
Slist = (J, NormalizedPolynomialSpace(J))
6161
@testset for S1 in Slist, S2 in Slist
6262
S = S1 S2
6363
test_transform!(v, v2, S)

test/LaguerreTest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, Test
22
import ApproxFunBaseTest: testbandedoperator
33

44

5-
@testset "Laguerre and WeightedLaguerre" begin
5+
@verbose @testset "Laguerre and WeightedLaguerre" begin
66

77
@testset "General scaled rays" begin
88
r = Ray(-1.0,0.0,2.0,true)

test/MultivariateTest.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ApproxFunOrthogonalPolynomials: chebyshevtransform
66

77
import Base: oneto
88

9-
@testset "Multivariate" begin
9+
@verbose @testset "Multivariate" begin
1010
@testset "Square" begin
1111
S = Space(ChebyshevInterval()^2)
1212
@test @inferred(blocklengths(S)) oneto(∞)
@@ -89,8 +89,8 @@ import Base: oneto
8989
D2 = Derivative(space(L), [0,1])
9090
@test (D2 * L)(0.1, 0.2) x(0.1)
9191
@test (D1 * L)(0.1, 0.2) y(0.2)
92-
# @test ((L * D1) * L)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
93-
# @test ((L * D2) * L)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
92+
@test ((L * D1) * L)(0.1, 0.2) x(0.1) * (y(0.2))^2
93+
@test ((L * D2) * L)(0.1, 0.2) (x(0.1))^2 * y(0.2)
9494
@test (D1[L] * L)(0.1, 0.2) 2x(0.1) * y(0.2)^2
9595
@test ((Derivative() I) * L)(0.1, 0.2) y(0.2)
9696
@test ((I Derivative()) * L)(0.1, 0.2) x(0.1)
@@ -345,8 +345,8 @@ import Base: oneto
345345
D2 = Derivative(Chebyshev() Chebyshev(), [0,1])
346346
@test (D2 * P)(0.1, 0.2) x(0.1)
347347
@test (D1 * P)(0.1, 0.2) y(0.2)
348-
# @test ((P * D1) * P)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
349-
# @test ((P * D2) * P)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
348+
@test ((P * D1) * P)(0.1, 0.2) x(0.1) * (y(0.2))^2
349+
@test ((P * D2) * P)(0.1, 0.2) (x(0.1))^2 * y(0.2)
350350
@test ((I Derivative()) * P)(0.1, 0.2) x(0.1)
351351
@test ((Derivative() I) * P)(0.1, 0.2) y(0.2)
352352

@@ -368,9 +368,9 @@ import Base: oneto
368368
M = [0 0 0; 0 1 0; 0 0 0]
369369
P = ProductFun(M, Chebyshev() Chebyshev(), chopping = true)
370370
@test coefficients(P) == @view M[1:2, 1:2]
371-
# M = zeros(3,3)
372-
# P = ProductFun(M, Chebyshev() ⊗ Chebyshev(), chopping = true)
373-
# @test all(iszero, coefficients(P))
371+
M = zeros(3,3)
372+
P = ProductFun(M, Chebyshev() Chebyshev(), chopping = true)
373+
@test all(iszero, coefficients(P))
374374
end
375375
end
376376

test/ODETest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, Test, Laz
22
import ApproxFunBase: Multiplication, interlace, ∞, ℵ₀
33
using ApproxFunBaseTest: testraggedbelowoperator, testbandedoperator
44

5-
@testset "ODE" begin
5+
@verbose @testset "ODE" begin
66
@testset "Airy" begin
77
d=Interval(-10.,5.);
88
S=Chebyshev(d)

test/OperatorTest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using ApproxFunBaseTest: testfunctional, testbandedoperator, testraggedbelowoper
44
testinfoperator, testblockbandedoperator
55
import ApproxFunOrthogonalPolynomials: JacobiZ
66

7-
@testset "Operator" begin
7+
@verbose @testset "Operator" begin
88
@testset "Evaluation" begin
99
testfunctional(Evaluation(Ultraspherical(1),0.1))
1010
d = -4 .. 4

test/PDETest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ApproxFunBase, ApproxFunOrthogonalPolynomials, LinearAlgebra, Test
22
import ApproxFunBase: Block, ldiv_coefficients
33
using ApproxFunBaseTest: testbandedblockbandedoperator, testblockbandedoperator, testraggedbelowoperator
44

5-
@testset "PDE" begin
5+
@verbose @testset "PDE" begin
66
@testset "Rectangle Laplace/Poisson" begin
77
dx = dy = ChebyshevInterval()
88
d = dx × dy

test/VectorTest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ApproxFunBase: interlace, Multiplication, ConstantSpace, PointSpace,
1111
using ApproxFunBaseTest: testblockbandedoperator, testraggedbelowoperator
1212

1313

14-
@testset "Vector" begin
14+
@verbose @testset "Vector" begin
1515
@testset "Construction" begin
1616
f = Fun(x->[1.,0.])
1717
@test f(0.) [1.,0.]

test/broadcastingtest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, LinearAlg
22

33

44

5-
@testset "broadcast" begin
5+
@verbose @testset "broadcast" begin
66
@testset "Special functions" begin
77
x = Fun()
88
@test exp(x) exp.(x) atol=10eps()

test/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ function test_transform!(v, v2, S)
2020
@test v2 v
2121
end
2222

23+
macro verbose(ex)
24+
head = ex.head
25+
args = ex.args
26+
@assert args[1] == Symbol("@testset")
27+
name = args[3] isa String ? args[3] : nothing
28+
if VERSION >= v"1.8"
29+
insert!(args, 3, Expr(:(=), :verbose, true))
30+
end
31+
quote
32+
$(Expr(head, args...))
33+
@info "Finished " * $name * " tests"
34+
end
35+
end
36+
2337
include("ClenshawTest.jl")
2438
include("ChebyshevTest.jl")
2539
include("ComplexTest.jl")

0 commit comments

Comments
 (0)