From b9637bdc719db419670d53188ef60ebbedd5b90a Mon Sep 17 00:00:00 2001 From: Ashutosh Bharambe Date: Mon, 7 Oct 2024 08:30:03 +0000 Subject: [PATCH] test(CubicSpline): add tests for `AbstractMatrix` --- test/interpolation_tests.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/interpolation_tests.jl b/test/interpolation_tests.jl index 69e5c197..97e2a8d4 100644 --- a/test/interpolation_tests.jl +++ b/test/interpolation_tests.jl @@ -599,6 +599,16 @@ end A = CubicSpline(u, t) @test_throws DataInterpolations.ExtrapolationError A(-2.0) @test_throws DataInterpolations.ExtrapolationError A(2.0) + + @testset "AbstractMatrix" begin + t = 0.1:0.1:1.0 + u = [sin.(t) cos.(t)]' |> collect + c = CubicSpline(u, t) + t_test = 0.1:0.05:1.0 + u_test = reduce(hcat, c.(t_test)) + @test isapprox(u_test[1, :], sin.(t_test), atol = 1e-3) + @test isapprox(u_test[2, :], cos.(t_test), atol = 1e-3) + end end @testset "BSplines" begin