@@ -47,6 +47,19 @@ YLEN = convert(Integer, floor((YMAX - YMIN)/ΔY) + 1)
47
47
@test interp (XMIN + ΔX / 2 ) ≈ f (XMIN + ΔX / 2 ) atol= .1
48
48
@test_throws BoundsError interp (XMIN - ΔX / 2 )
49
49
@test_throws BoundsError interp (XMAX + ΔX / 2 )
50
+
51
+ # Check deprecated usage
52
+ interp = ConstantInterpolation (xs, A; extrapolation_bc = Throw ()) # using convenience constructor
53
+ interp_full = extrapolate (scale (interpolate (A, BSpline (Constant ())), xs), Throw ()) # using full constructor
54
+
55
+ @test typeof (interp) == typeof (interp_full)
56
+ @test interp (XMIN) ≈ f (XMIN)
57
+ @test interp (XMAX) ≈ f (XMAX)
58
+ @test interp (XMIN + ΔX) ≈ f (XMIN + ΔX)
59
+ @test interp (XMAX - ΔX) ≈ f (XMAX - ΔX)
60
+ @test interp (XMIN + ΔX / 2 ) ≈ f (XMIN + ΔX / 2 ) atol= .1
61
+ @test_throws BoundsError interp (XMIN - ΔX / 2 )
62
+ @test_throws BoundsError interp (XMAX + ΔX / 2 )
50
63
end
51
64
52
65
@testset " 1d-regular-grids-cubic" begin
@@ -64,6 +77,19 @@ YLEN = convert(Integer, floor((YMAX - YMIN)/ΔY) + 1)
64
77
@test interp (XMIN + ΔX / 2 ) ≈ f (XMIN + ΔX / 2 ) atol= .1
65
78
@test_throws BoundsError interp (XMIN - ΔX / 2 )
66
79
@test_throws BoundsError interp (XMAX + ΔX / 2 )
80
+
81
+ # Check deprecated usage
82
+ interp = CubicSplineInterpolation (xs, A; extrapolation_bc = Throw ())
83
+ interp_full = extrapolate (scale (interpolate (A, BSpline (Cubic (Line (OnGrid ())))), xs), Throw ())
84
+
85
+ @test typeof (interp) == typeof (interp_full)
86
+ @test interp (XMIN) ≈ f (XMIN)
87
+ @test interp (XMAX) ≈ f (XMAX)
88
+ @test interp (XMIN + ΔX) ≈ f (XMIN + ΔX)
89
+ @test interp (XMAX - ΔX) ≈ f (XMAX - ΔX)
90
+ @test interp (XMIN + ΔX / 2 ) ≈ f (XMIN + ΔX / 2 ) atol= .1
91
+ @test_throws BoundsError interp (XMIN - ΔX / 2 )
92
+ @test_throws BoundsError interp (XMAX + ΔX / 2 )
67
93
end
68
94
69
95
@testset " 1d-irregular-grids" begin
@@ -117,6 +143,14 @@ YLEN = convert(Integer, floor((YMAX - YMIN)/ΔY) + 1)
117
143
@test typeof (extrap) == typeof (extrap_full)
118
144
@test extrap (x_lower) ≈ A[1 ] - ΔA_l
119
145
@test extrap (x_higher) ≈ A[end ] + ΔA_h
146
+
147
+ # Check deprecated usage
148
+ extrap = LinearInterpolation (xs, A, extrapolation_bc = Line ())
149
+ extrap_full = extrapolate (scale (interpolate (A, BSpline (Linear ())), xs), Line ())
150
+
151
+ @test typeof (extrap) == typeof (extrap_full)
152
+ @test extrap (x_lower) ≈ A[1 ] - ΔA_l
153
+ @test extrap (x_higher) ≈ A[end ] + ΔA_h
120
154
end
121
155
end
122
156
262
296
@test typeof (extrap) == typeof (extrap_full)
263
297
@test extrap (x_lower, y_lower) ≈ A[1 , 1 ] - ΔA_l
264
298
@test extrap (x_higher, y_higher) ≈ A[end , end ] + ΔA_h
299
+
300
+ # Check deprecated usage
301
+ extrap = LinearInterpolation ((xs, ys), A, extrapolation_bc = (Line (), Flat ()))
302
+ extrap_full = extrapolate (scale (interpolate (A, BSpline (Linear ())), xs, ys), (Line (), Flat ()))
303
+
304
+ @test typeof (extrap) == typeof (extrap_full)
305
+ @test extrap (x_lower, y_lower) ≈ A[1 , 1 ] - ΔA_l
306
+ @test extrap (x_higher, y_higher) ≈ A[end , end ] + ΔA_h
265
307
end
266
308
267
309
@testset " issue #230" begin # at least, I think this is what issue #230 is really about
0 commit comments