@@ -8,85 +8,80 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
88 end
99
1010 @testset " ChebyshevInterval" begin
11- @test Fun (x-> 2 ,10 )(.1 ) ≈ 2
12- @test Fun (x-> 2 )(.1 ) ≈ 2
13- @test Fun (Chebyshev,Float64[]).([0. ,1. ]) ≈ [0. ,0. ]
14- @test Fun (Chebyshev,[])(0. ) ≈ 0.
15- @test Fun (x-> 4 ,Chebyshev (),1 ). coefficients == [4.0 ]
16- @test Fun (x-> 4 ). coefficients == [4.0 ]
17- @test Fun (4 ). coefficients == [4.0 ]
11+ @test @inferred Fun (x-> 2 ,10 )(.1 ) ≈ 2
12+ @test @inferred Fun (x-> 2 )(.1 ) ≈ 2
13+ @test @inferred Fun (Chebyshev,Float64[]).([0. ,1. ]) ≈ [0. ,0. ]
14+ @test @inferred Fun (Chebyshev,[])(0. ) ≈ 0.
15+ @test @inferred Fun (x-> 4 ,Chebyshev (),1 ). coefficients == [4.0 ]
16+ @test @inferred Fun (x-> 4 ). coefficients == [4.0 ]
17+ @test @inferred Fun (4 ). coefficients == [4.0 ]
1818
1919
20- @test Fun (x-> 4 ). coefficients == [4.0 ]
21- @test Fun (4 ). coefficients == [4.0 ]
20+ @test @inferred Fun (x-> 4 ). coefficients == [4.0 ]
21+ @test @inferred Fun (4 ). coefficients == [4.0 ]
2222
23- f = Fun (ChebyshevInterval (), [1 ])
23+ f = @inferred Fun (ChebyshevInterval (), [1 ])
2424 @test f (0.1 ) == 1
2525
26- ef = Fun (exp)
27- @test ef (0.1 ) ≈ exp (0.1 )
26+ ef = if VERSION >= v " 1.8"
27+ @inferred Fun (exp)
28+ else
29+ Fun (exp)
30+ end
31+ @test @inferred ef (0.1 ) ≈ exp (0.1 )
32+ @test @inferred ef (.5 ) ≈ exp (.5 )
2833
2934 for d in (ChebyshevInterval (),Interval (1. ,2. ),Segment (1.0 + im,2.0 + 2im ))
3035 testspace (Chebyshev (d))
3136 end
3237
33- ef = Fun (exp,ChebyshevInterval ())
34-
35- @test ef == - (- ef)
36- @test ef == (ef- 1 ) + 1
37-
38- ef = Fun (exp)
39-
40- cf = Fun (cos)
41-
42- ecf = Fun (x-> cos (x).* exp (x))
43- eocf = Fun (x-> cos (x)./ exp (x))
44-
45- @test ef (.5 ) ≈ exp (.5 )
46- @test ecf (.123456 ) ≈ cos (.123456 ).* exp (.123456 )
38+ y = @inferred Fun () + Fun (ChebyshevInterval {BigFloat} ())
39+ @test y == 2 Fun ()
4740 end
4841
4942 @testset " Algebra" begin
50- ef = Fun (exp,ChebyshevInterval ())
51-
52- @test ef == - (- ef)
43+ ef = @inferred Fun (exp,ChebyshevInterval ())
44+ @test ef == @inferred - (- ef)
5345 @test ef == (ef- 1 ) + 1
5446
55- @test ef / 3 == (3 \ ef)
56-
47+ if VERSION >= v " 1.8"
48+ @test (@inferred ef / 3 ) == @inferred (3 \ ef)
49+ else
50+ @test ef / 3 == 3 \ ef
51+ end
5752
5853 cf = Fun (cos)
5954
60- ecf = Fun (x-> cos (x). *exp (x))
61- eocf = Fun (x-> cos (x). /exp (x))
55+ ecf = VERSION >= v " 1.8 " ? @inferred ( Fun (x-> cos (x)* exp (x))) : Fun (x -> cos (x) * exp (x))
56+ eocf = VERSION >= v " 1.8 " ? @inferred ( Fun (x-> cos (x)/ exp (x))) : Fun (x -> cos (x) / exp (x))
6257
6358 @test ef (.5 ) ≈ exp (.5 )
6459 @test ecf (.123456 ) ≈ cos (.123456 ).* exp (.123456 )
6560
6661 r= 2 .* rand (100 ) .- 1
6762
68- @test maximum (abs,ef .(r)- exp .(r))< 200 eps ()
69- @test maximum (abs,ecf .(r).- cos .(r).* exp .(r))< 200 eps ()
63+ @test @inferred maximum (abs,ef .(r)- exp .(r))< 200 eps ()
64+ @test @inferred maximum (abs,ecf .(r).- cos .(r).* exp .(r))< 200 eps ()
7065
71- @test (cf .* ef)(0.1 ) ≈ ecf (0.1 ) ≈ cos (0.1 )* exp (0.1 )
72- @test domain (cf.* ef) ≈ domain (ecf)
73- @test domain (cf.* ef) == domain (ecf)
66+ @test (@inferred ( cf .* ef)(0.1 ) ) ≈ ecf (0.1 ) ≈ cos (0.1 )* exp (0.1 )
67+ @test ( @inferred domain (cf.* ef) ) ≈ domain (ecf)
68+ @test ( @inferred domain (cf.* ef) ) == domain (ecf)
7469
75- @test norm ((ecf- cf.* ef). coefficients)< 200 eps ()
76- @test maximum (abs,( eocf- cf./ ef). coefficients)< 1000 eps ()
70+ @test norm (@inferred (ecf- cf.* ef). coefficients)< 200 eps ()
71+ @test maximum (abs,@inferred (( eocf- cf./ ef) ). coefficients)< 1000 eps ()
7772 @test norm (((ef/ 3 ). * (3 / ef)- 1 ). coefficients)< 1000 eps ()
7873 end
7974
8075 @testset " Diff and cumsum" begin
8176 ef = Fun (exp)
8277 cf = Fun (cos)
83- @test norm ((ef - ef' ). coefficients)< 10E-11
78+ @test norm (@inferred (ef - ef' ). coefficients)< 10E-11
8479
85- @test norm ((ef - cumsum (ef)' ). coefficients) < 20 eps ()
86- @test norm ((cf - cumsum (cf)' ). coefficients) < 20 eps ()
80+ @test norm (@inferred (ef - cumsum (ef)' ). coefficients) < 20 eps ()
81+ @test norm (@inferred (cf - cumsum (cf)' ). coefficients) < 20 eps ()
8782
88- @test sum (ef) ≈ 2.3504023872876028
89- @test norm (ef) ≈ 1.90443178083307
83+ @test @inferred ( sum (ef) ) ≈ 2.3504023872876028
84+ @test @inferred ( norm (ef) ) ≈ 1.90443178083307
9085 end
9186
9287 @testset " other domains" begin
0 commit comments