Skip to content

Commit

Permalink
test: update CubicSpline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sathvikbhagavan committed Mar 26, 2024
1 parent 331c9c7 commit 60ad06a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/interpolation_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ end
A = CubicSpline(u, t; extrapolate = true)

# Solution
P₁ = x -> 1 + 1.5x + x^2 + 0.5x^3 # for x ∈ [-1.0, 0.0]
P₂ = x -> 1 + 1.5x + x^2 - 0.5x^3 # for x ∈ [0.0, 1.0]
P₁ = x -> 1 + 1.5x + 0.75 * x^2 + 0.25 * x^3 # for x ∈ [-1.0, 0.0]
P₂ = x -> 1 + 1.5x + 0.75 * x^2 - 0.25 * x^3 # for x ∈ [0.0, 1.0]

for (_t, _u) in zip(t, u)
@test A(_t) == _u
Expand Down Expand Up @@ -534,8 +534,8 @@ end
u = [0.0, 1.0, 3.0]
t = [-1.0, 0.0, 1.0]
A = CubicSpline(u, t; extrapolate = true)
@test A(-2.0) -2.0
@test A(2.0) 4.0
@test A(-2.0) -1.0
@test A(2.0) 5.0
A = CubicSpline(u, t)
@test_throws DataInterpolations.ExtrapolationError A(-2.0)
@test_throws DataInterpolations.ExtrapolationError A(2.0)
Expand Down

0 comments on commit 60ad06a

Please sign in to comment.