From 315dc9d342db17b4836edb320df783fa7e3f1d2b Mon Sep 17 00:00:00 2001 From: Ashutosh Bharambe Date: Sat, 26 Oct 2024 06:55:06 +0000 Subject: [PATCH] test(BSplines): add tests --- test/interpolation_tests.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/interpolation_tests.jl b/test/interpolation_tests.jl index 9af43d37..3f13973f 100644 --- a/test/interpolation_tests.jl +++ b/test/interpolation_tests.jl @@ -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 @@ -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