Skip to content

Commit

Permalink
test(BSplines): add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh-b-b committed Oct 26, 2024
1 parent 430e87d commit 315dc9d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/interpolation_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ end
@test_throws DataInterpolations.ExtrapolationError A(-1.0)
@test_throws DataInterpolations.ExtrapolationError A(300.0)

@testset "Vector{Vector}" begin end

@testset "AbstractMatrix" begin
t = 0.1:0.1:1.0
u2d = [sin.(t) cos.(t)]' |> collect
Expand Down Expand Up @@ -721,6 +723,21 @@ end
@test_throws DataInterpolations.ExtrapolationError A(-1.0)
@test_throws DataInterpolations.ExtrapolationError A(300.0)

@testset "Vector{Vector}" begin
t = 0.1:0.1:1.0
u_vec = [[sin.(t_), cos.(t_)] for t_ in t]
A = BSplineApprox(u_vec, t, 2, 5, :Uniform, :Uniform)
t_test = 0.1:0.05:1.0
u_test = reduce(hcat, A.(t_test))
@test isapprox(u_test[1, :], sin.(t_test), atol = 1e-3)
@test isapprox(u_test[2, :], cos.(t_test), atol = 1e-3)

A = BSplineApprox(u_vec, t, 2, 5, :ArcLen, :Average)
u_test = reduce(hcat, A.(t_test))
@test isapprox(u_test[1, :], sin.(t_test), atol = 1e-2)
@test isapprox(u_test[2, :], cos.(t_test), atol = 1e-2)
end

@testset "AbstractMatrix" begin
t = 0.1:0.1:1.0
u2d = [sin.(t) cos.(t)]' |> collect
Expand Down

0 comments on commit 315dc9d

Please sign in to comment.