Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Apr 2, 2024
1 parent 5993d13 commit dc739b2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,23 @@ end
sys2 = processes_to_mtkmodel([sys, w ~ x*y])
@test length(equations(sys2)) == 4
@test sort(ModelingToolkit.getname.(unknowns(sys2))) == [:w, :x, :y, :z]
end
end

@testset "registering default" begin
module TestDefault
using ProcessBasedModelling
@variables x(t) = 0.5 y(t) = 0.2
register_default_process!([
Differential(t)(x) ~ 0.2y - x,
y ~ x^2,
], TestDefault)
end

using .TestDefault
@variables z(t) = 0.1
eqs = [z ~ TestDefault.x - 1]
mtk = processes_to_mtkmodel(eqs, TestDefault)
@test length(unknowns(mtk)) == 3
@test has_symbolic_var(mtk, z)
@test has_symbolic_var(mtk, TestDefault.x)
end

0 comments on commit dc739b2

Please sign in to comment.