Skip to content

verbose testset reporting #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions test/ChebyshevTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@ import ApproxFunBase: recA, recB, recC, transform!, itransform!
import ApproxFunBaseTest: testspace
import ApproxFunOrthogonalPolynomials: forwardrecurrence

@testset "Chebyshev" begin
@verbose @testset "Chebyshev" begin
@testset "Forward recurrence" begin
@test forwardrecurrence(Float64,Chebyshev(),0:9,1.0) == ones(10)
end

@testset "ChebyshevInterval" begin
@test @inferred Fun(x->2,10)(.1) ≈ 2
@test @inferred Fun(x->2)(.1) ≈ 2
@test @inferred Fun(Chebyshev,Float64[]).([0.,1.]) ≈ [0.,0.]
@test @inferred Fun(Chebyshev,[])(0.) ≈ 0.
@test @inferred Fun(x->4,Chebyshev(),1).coefficients == [4.0]
@test @inferred Fun(x->4).coefficients == [4.0]
@test @inferred Fun(4).coefficients == [4.0]


@test @inferred Fun(x->4).coefficients == [4.0]
@test @inferred Fun(4).coefficients == [4.0]
@test @inferred(Fun(x->2,10))(.1) ≈ 2
@test Fun(x->2)(.1) ≈ 2
@test @inferred(Fun(Chebyshev, Float64[])).([0.,1.]) ≈ [0.,0.]
@test Fun(Chebyshev, [])(0.) ≈ 0.
@test @inferred(Fun(x->4, Chebyshev(), 1)).coefficients == [4.0]
@test Fun(x->4).coefficients == [4.0]
@test @inferred(Fun(4)).coefficients == [4.0]

f = @inferred Fun(ChebyshevInterval(), [1])
@test f(0.1) == 1
Expand Down Expand Up @@ -61,8 +57,8 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence

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

@test @inferred maximum(abs,ef.(r)-exp.(r))<200eps()
@test @inferred maximum(abs,ecf.(r).-cos.(r).*exp.(r))<200eps()
@test @inferred(maximum(abs,ef.(r)-exp.(r))) < 200eps()
@test @inferred(maximum(abs,ecf.(r).-cos.(r).*exp.(r))) < 200eps()

@test (@inferred (cf .* ef)(0.1)) ≈ ecf(0.1) ≈ cos(0.1)*exp(0.1)
@test (@inferred domain(cf.*ef)) ≈ domain(ecf)
Expand Down Expand Up @@ -108,8 +104,8 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
ef = Fun(exp,1..2)
cf = Fun(cos,1..2)

ecf = Fun(x->cos(x).*exp(x),1..2)
eocf = Fun(x->cos(x)./exp(x),1..2)
ecf = Fun(x->cos(x)*exp(x),1..2)
eocf = Fun(x->cos(x)/exp(x),1..2)

r=rand(100) .+ 1
x=1.5
Expand Down Expand Up @@ -216,16 +212,16 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
end

@testset "inplace transform" begin
@testset for T in [Float32, Float64], ET in Any[T, complex(T)]
v = Array{ET}(undef, 10)
@testset for T in (Float32, Float64), ET in (T, complex(T))
v = Array{ET}(undef, 6)
v2 = similar(v)
M = Array{ET}(undef, 10, 10)
M = Array{ET}(undef, 6, 6)
M2 = similar(M)
A = Array{ET}(undef, 10, 10, 10)
A = Array{ET}(undef, 6, 6, 6)
A2 = similar(A)
@testset for d in Any[(), (0..1,)]
@testset for d in ((), (0..1,))
C = Chebyshev(d...)
Slist = Any[C, NormalizedPolynomialSpace(C)]
Slist = (C, NormalizedPolynomialSpace(C))
@testset for S in Slist
test_transform!(v, v2, S)
end
Expand Down
12 changes: 6 additions & 6 deletions test/JacobiTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using ApproxFunBaseTest: testbandedbelowoperator, testbandedoperator, testspace,
testfunctional
import ApproxFunOrthogonalPolynomials: jacobip

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

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

@testset "inplace transform" begin
@testset for T in [Float32, Float64], ET in Any[T, complex(T)]
@testset for T in (Float32, Float64), ET in (T, complex(T))
v = Array{ET}(undef, 10)
v2 = similar(v)
@testset for a in 0:0.5:3, b in 0:0.5:3, d in Any[(), (0..1,)]
@testset for a in 0:0.5:3, b in 0:0.5:3, d in ((), (0..1,))
J = Jacobi(a, b, d...)
Slist = Any[J, NormalizedPolynomialSpace(J)]
Slist = (J, NormalizedPolynomialSpace(J))
@testset for S in Slist
test_transform!(v, v2, S)
end
end
v = Array{ET}(undef, 10, 10)
v2 = similar(v)
@testset for a in 0:0.5:3, b in 0:0.5:3, d in Any[(), (0..1,)]
@testset for a in 0:0.5:3, b in 0:0.5:3, d in ((), (0..1,))
J = Jacobi(a, b, d...)
Slist = Any[J, NormalizedPolynomialSpace(J)]
Slist = (J, NormalizedPolynomialSpace(J))
@testset for S1 in Slist, S2 in Slist
S = S1 ⊗ S2
test_transform!(v, v2, S)
Expand Down
2 changes: 1 addition & 1 deletion test/LaguerreTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, Test
import ApproxFunBaseTest: testbandedoperator


@testset "Laguerre and WeightedLaguerre" begin
@verbose @testset "Laguerre and WeightedLaguerre" begin

@testset "General scaled rays" begin
r = Ray(-1.0,0.0,2.0,true)
Expand Down
16 changes: 8 additions & 8 deletions test/MultivariateTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ApproxFunOrthogonalPolynomials: chebyshevtransform

import Base: oneto

@testset "Multivariate" begin
@verbose @testset "Multivariate" begin
@testset "Square" begin
S = Space(ChebyshevInterval()^2)
@test @inferred(blocklengths(S)) ≡ oneto(∞)
Expand Down Expand Up @@ -89,8 +89,8 @@ import Base: oneto
D2 = Derivative(space(L), [0,1])
@test (D2 * L)(0.1, 0.2) ≈ x(0.1)
@test (D1 * L)(0.1, 0.2) ≈ y(0.2)
# @test ((L * D1) * L)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
# @test ((L * D2) * L)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
@test ((L * D1) * L)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
@test ((L * D2) * L)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
@test (D1[L] * L)(0.1, 0.2) ≈ 2x(0.1) * y(0.2)^2
@test ((Derivative() ⊗ I) * L)(0.1, 0.2) ≈ y(0.2)
@test ((I ⊗ Derivative()) * L)(0.1, 0.2) ≈ x(0.1)
Expand Down Expand Up @@ -345,8 +345,8 @@ import Base: oneto
D2 = Derivative(Chebyshev() ⊗ Chebyshev(), [0,1])
@test (D2 * P)(0.1, 0.2) ≈ x(0.1)
@test (D1 * P)(0.1, 0.2) ≈ y(0.2)
# @test ((P * D1) * P)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
# @test ((P * D2) * P)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
@test ((P * D1) * P)(0.1, 0.2) ≈ x(0.1) * (y(0.2))^2
@test ((P * D2) * P)(0.1, 0.2) ≈ (x(0.1))^2 * y(0.2)
@test ((I ⊗ Derivative()) * P)(0.1, 0.2) ≈ x(0.1)
@test ((Derivative() ⊗ I) * P)(0.1, 0.2) ≈ y(0.2)

Expand All @@ -368,9 +368,9 @@ import Base: oneto
M = [0 0 0; 0 1 0; 0 0 0]
P = ProductFun(M, Chebyshev() ⊗ Chebyshev(), chopping = true)
@test coefficients(P) == @view M[1:2, 1:2]
# M = zeros(3,3)
# P = ProductFun(M, Chebyshev() ⊗ Chebyshev(), chopping = true)
# @test all(iszero, coefficients(P))
M = zeros(3,3)
P = ProductFun(M, Chebyshev() ⊗ Chebyshev(), chopping = true)
@test all(iszero, coefficients(P))
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/ODETest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, Test, Laz
import ApproxFunBase: Multiplication, interlace, ∞, ℵ₀
using ApproxFunBaseTest: testraggedbelowoperator, testbandedoperator

@testset "ODE" begin
@verbose @testset "ODE" begin
@testset "Airy" begin
d=Interval(-10.,5.);
S=Chebyshev(d)
Expand Down
2 changes: 1 addition & 1 deletion test/OperatorTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using ApproxFunBaseTest: testfunctional, testbandedoperator, testraggedbelowoper
testinfoperator, testblockbandedoperator
import ApproxFunOrthogonalPolynomials: JacobiZ

@testset "Operator" begin
@verbose @testset "Operator" begin
@testset "Evaluation" begin
testfunctional(Evaluation(Ultraspherical(1),0.1))
d = -4 .. 4
Expand Down
2 changes: 1 addition & 1 deletion test/PDETest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using ApproxFunBase, ApproxFunOrthogonalPolynomials, LinearAlgebra, Test
import ApproxFunBase: Block, ldiv_coefficients
using ApproxFunBaseTest: testbandedblockbandedoperator, testblockbandedoperator, testraggedbelowoperator

@testset "PDE" begin
@verbose @testset "PDE" begin
@testset "Rectangle Laplace/Poisson" begin
dx = dy = ChebyshevInterval()
d = dx × dy
Expand Down
2 changes: 1 addition & 1 deletion test/VectorTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ApproxFunBase: interlace, Multiplication, ConstantSpace, PointSpace,
using ApproxFunBaseTest: testblockbandedoperator, testraggedbelowoperator


@testset "Vector" begin
@verbose @testset "Vector" begin
@testset "Construction" begin
f = Fun(x->[1.,0.])
@test f(0.) ≈ [1.,0.]
Expand Down
2 changes: 1 addition & 1 deletion test/broadcastingtest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, SpecialFunctions, LinearAlg



@testset "broadcast" begin
@verbose @testset "broadcast" begin
@testset "Special functions" begin
x = Fun()
@test exp(x) ≈ exp.(x) atol=10eps()
Expand Down
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ function test_transform!(v, v2, S)
@test v2 ≈ v
end

macro verbose(ex)
head = ex.head
args = ex.args
@assert args[1] == Symbol("@testset")
name = args[3] isa String ? args[3] : nothing
if VERSION >= v"1.8"
insert!(args, 3, Expr(:(=), :verbose, true))
end
quote
$(Expr(head, args...))
@info "Finished " * $name * " tests"
end
end

include("ClenshawTest.jl")
include("ChebyshevTest.jl")
include("ComplexTest.jl")
Expand Down