Skip to content

Commit f838847

Browse files
authored
Modules in tests (#256)
* Modules in tests * import LinearAlgebra in Hermite tests * LinearAlgebra imports in ComplexTest and ODETest * import Test in ShowTest
1 parent a89edbd commit f838847

18 files changed

+105
-22
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2222
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2323

2424
[compat]
25-
ApproxFunBase = "0.8.23"
25+
ApproxFunBase = "0.8.28"
2626
ApproxFunBaseTest = "0.1"
2727
Aqua = "0.6"
2828
BandedMatrices = "0.16, 0.17"

src/Spaces/PolynomialSpace.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,6 @@ function Multiplication(f::Fun{<:NormalizedPolynomialSpace}, sp::NormalizedPolyn
567567
Multiplication(fc, sp)
568568
end
569569

570-
function Derivative(sp::NormalizedPolynomialSpace, k::Number)
571-
assert_integer(k)
572-
csp=canonicalspace(sp)
573-
D = Derivative(csp,k)
574-
C = ConcreteConversion(sp,csp)
575-
DerivativeWrapper(TimesOperator(D, C), k, sp, rangespace(D))
576-
end
577-
578570
ApproxFunBase.hasconcreteconversion_canonical(
579571
@nospecialize(::NormalizedPolynomialSpace), @nospecialize(_)) = true
580572

test/ChebyshevTest.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
module ChebyshevTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using ApproxFunBase
35
using LinearAlgebra
46
using Test
5-
using ApproxFunBase: recA, recB, recC, transform!, itransform!
7+
using ApproxFunBase: transform!, itransform!
68
using ApproxFunBaseTest: testspace
79
using ApproxFunOrthogonalPolynomials: forwardrecurrence
810

11+
include("testutils.jl")
12+
913
@verbose @testset "Chebyshev" begin
1014
@testset "Forward recurrence" begin
1115
@test forwardrecurrence(Float64,Chebyshev(),0:9,1.0) == ones(10)
@@ -456,3 +460,5 @@ using ApproxFunOrthogonalPolynomials: forwardrecurrence
456460
@test normalizedspace(NS) == NS
457461
end
458462
end
463+
464+
end # module

test/ClenshawTest.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module ClenshawTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using StaticArrays
35
using Test
@@ -6,3 +8,5 @@ using Test
68
test_function = Fun(sin, 50)
79
@test test_function(0.9) clenshaw(0.9, SVector{50}(test_function.coefficients))
810
end
11+
12+
end # module

test/ComplexTest.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
module ComplexTest
2+
13
using ApproxFunOrthogonalPolynomials
4+
using LinearAlgebra
25
using Test
36

47
@testset "Complex" begin
@@ -27,3 +30,5 @@ using Test
2730
@test norm(integrate(f)+im*f-f.coefficients[1]*im) < 100eps()
2831
end
2932
end
33+
34+
end # module

test/EigTest.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module EigTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using ApproxFunBase
35
using ApproxFunBase: bandwidth
@@ -177,3 +179,5 @@ using Test
177179
@test eltype(λ) == Complex{Float64}
178180
end
179181
end
182+
183+
end # module

test/HermiteTest.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
module HermiteTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using ApproxFunBase
5+
using ApproxFunBaseTest: testbandedoperator
6+
using LinearAlgebra
37
using SpecialFunctions
48
using Test
5-
using ApproxFunBaseTest: testbandedoperator
69

710
@testset "Hermite and GaussWeight" begin
811
@testset "Evaluation" begin
@@ -75,3 +78,5 @@ using ApproxFunBaseTest: testbandedoperator
7578
@test g(1.) 3.
7679
end
7780
end
81+
82+
end # module

test/JacobiTest.jl

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module JacobiTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using ApproxFunBase
35
using Test
@@ -13,6 +15,8 @@ using Static
1315
using HalfIntegers
1416
using OddEvenIntegers
1517

18+
include("testutils.jl")
19+
1620
@verbose @testset "Jacobi" begin
1721
@testset "Basic" begin
1822
@test jacobip(0:5,2,0.5,0.1) [1.,0.975,-0.28031249999999996,-0.8636328125,-0.0022111816406250743,0.7397117980957031]
@@ -694,16 +698,21 @@ using OddEvenIntegers
694698
@inferred (() -> Integral(Legendre()))()
695699
@inferred (() -> Integral(Jacobi(1,1)))()
696700
@inferred (() -> Integral(Jacobi(Ultraspherical(1))))()
697-
@testset for sp in (Legendre(), Jacobi(1,1), Jacobi(Ultraspherical(1)))
698-
Ij = Integral(sp, 1)
699-
@test !isdiag(Ij)
700-
f = Fun(sp)
701-
g = Ij * f
702-
g = Fun(g, sp)
703-
g = g - coefficients(g)[1]
704-
gexp = Fun(x->x^2/2, sp)
705-
gexp = gexp - coefficients(gexp)[1]
706-
@test g gexp
701+
@inferred (() -> Integral(NormalizedLegendre()))()
702+
@inferred (() -> Integral(NormalizedJacobi(1,1)))()
703+
@inferred (() -> Integral(NormalizedJacobi(NormalizedUltraspherical(1))))()
704+
for sp in (Legendre(), Jacobi(1,1), Jacobi(Ultraspherical(1)))
705+
@testset for _sp in (sp, NormalizedPolynomialSpace(sp))
706+
Ij = Integral(_sp, 1)
707+
@test !isdiag(Ij)
708+
f = Fun(sp)
709+
g = Ij * f
710+
g = Fun(g, sp)
711+
g = g - coefficients(g)[1]
712+
gexp = Fun(x->x^2/2, sp)
713+
gexp = gexp - coefficients(gexp)[1]
714+
@test g gexp
715+
end
707716
end
708717

709718
@testset for n in 3:6, d in ((), (0..1,)),
@@ -740,3 +749,5 @@ using OddEvenIntegers
740749
@test ApproxFunBase.hasconversion(Chebyshev()*Legendre(), NormalizedChebyshev()*NormalizedLegendre())
741750
end
742751
end
752+
753+
end # module

test/LaguerreTest.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
module LaguerreTest
2+
13
using ApproxFunOrthogonalPolynomials
24
using ApproxFunBase
35
using SpecialFunctions
46
using Test
57
using ApproxFunBaseTest: testbandedoperator
68

9+
include("testutils.jl")
710

811
@verbose @testset "Laguerre and WeightedLaguerre" begin
912
@testset "Ray" begin
@@ -107,3 +110,5 @@ using ApproxFunBaseTest: testbandedoperator
107110
@test rangespace(M) == LaguerreWeight(-0.5,Laguerre())
108111
end
109112
end
113+
114+
end # module

test/MultivariateTest.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module MultivariateTest
2+
13
using ApproxFunBase
24
using ApproxFunOrthogonalPolynomials
35
using LinearAlgebra
@@ -12,6 +14,8 @@ using StaticArrays: SVector
1214

1315
using Base: oneto
1416

17+
include("testutils.jl")
18+
1519
@verbose @testset "Multivariate" begin
1620
@testset "vectorization order" begin
1721
@testset "2D trivial" begin
@@ -563,3 +567,5 @@ using Base: oneto
563567
@test d2 == (0..1) × (0.0..2.0) × (0..2)
564568
end
565569
end
570+
571+
end # module

0 commit comments

Comments
 (0)