Skip to content

Commit 5764324

Browse files
committed
test: add tests for InterpolationBlock
1 parent 13ba00f commit 5764324

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

test/Blocks/sources.jl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,30 @@ end
482482
end
483483
end
484484

485-
@testset "ParametrizedInterpolation" begin
485+
@testset "InterpolationBlock" begin
486+
@variables y(t) = 0
487+
u = rand(15)
488+
x = 0:14.0
489+
490+
@named i = InterpolationBlock(LinearInterpolation, u, x)
491+
eqs = [D(y) ~ i.output.u]
492+
493+
@named model = ODESystem(eqs, t, systems = [i])
494+
sys = structural_simplify(model)
495+
496+
prob = ODEProblem{true, SciMLBase.FullSpecialize}(sys, [], (0.0, 4))
497+
sol = solve(prob, Tsit5())
498+
499+
@test SciMLBase.successful_retcode(sol)
500+
end
501+
502+
@testset "ParametrizedInterpolationBlock" begin
486503
@variables y(t) = 0
487504
u = rand(15)
488505
x = 0:14.0
489506

490507
@testset "LinearInterpolation" begin
491-
@named i = ParametrizedInterpolation(LinearInterpolation, u, x)
508+
@named i = ParametrizedInterpolationBlock(LinearInterpolation, u, x)
492509
eqs = [D(y) ~ i.output.u]
493510

494511
@named model = ODESystem(eqs, t, systems = [i])
@@ -537,7 +554,7 @@ end
537554
end
538555

539556
@testset "BSplineInterpolation" begin
540-
@named i = ParametrizedInterpolation(
557+
@named i = ParametrizedInterpolationBlock(
541558
BSplineInterpolation, u, x, 3, :Uniform, :Uniform)
542559
eqs = [D(y) ~ i.output.u]
543560

0 commit comments

Comments
 (0)