Skip to content

Commit

Permalink
test: add test for BSplineInterpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianM-C committed Aug 5, 2024
1 parent b453a88 commit a6824ab
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions test/Blocks/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -480,16 +480,31 @@ end
@testset "ParametrizedInterpolation" begin
@variables y(t) = 0
@parameters u[1:15] = rand(15)
@parameters x[1:15] = 0:14
@parameters x[1:15] = 0:14.0

@named i = ParametrizedInterpolation(LinearInterpolation, u, x)
eqs = [D(y) ~ i.output.u]
@testset "LinearInterpolation" begin
@named i = ParametrizedInterpolation(LinearInterpolation, u, x)
eqs = [D(y) ~ i.output.u]

@named model = ODESystem(eqs, t, systems = [i])
sys = structural_simplify(model)
@named model = ODESystem(eqs, t, systems = [i])
sys = structural_simplify(model)

prob = ODEProblem(sys, [], (0.0, 4))
sol = solve(prob)
prob = ODEProblem(sys, [], (0.0, 4))
sol = solve(prob)

@test SciMLBase.successful_retcode(sol)
@test SciMLBase.successful_retcode(sol)
end

@testset "BSplineInterpolation" begin
@named i = ParametrizedInterpolation(BSplineInterpolation, u, x, 3, :Uniform, :Uniform)
eqs = [D(y) ~ i.output.u]

@named model = ODESystem(eqs, t, systems = [i])
sys = structural_simplify(model)

prob = ODEProblem(sys, [], (0.0, 4))
sol = solve(prob)

@test SciMLBase.successful_retcode(sol)
end
end

0 comments on commit a6824ab

Please sign in to comment.