From dc739b245ac1e45713a73f04e29bee3440747021 Mon Sep 17 00:00:00 2001 From: Datseris Date: Tue, 2 Apr 2024 11:17:11 +0100 Subject: [PATCH] tests --- test/runtests.jl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 406e523..5f82907 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 \ No newline at end of file +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