Skip to content

Commit 9c47eaa

Browse files
test: test application of problem_type via system metadata
1 parent 5a4bbc1 commit 9c47eaa

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/nonlinearsystem.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,11 @@ end
434434
@test resid == [0.0]
435435
@test resid isa SVector
436436
end
437+
438+
@testset "`ProblemTypeCtx`" begin
439+
@variables x
440+
@mtkcompile sys = System(
441+
[0 ~ x^2 - 4x + 4]; metadata = [ModelingToolkit.ProblemTypeCtx => "A"])
442+
prob = NonlinearProblem(sys, [x => 1.0])
443+
@test prob.problem_type == "A"
444+
end

test/odesystem.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,3 +1566,11 @@ end
15661566
@test !process_running(proc)
15671567
kill(proc, Base.SIGKILL)
15681568
end
1569+
1570+
@testset "`ProblemTypeCtx`" begin
1571+
@variables x(t)
1572+
@mtkcompile sys = System(
1573+
[D(x) ~ x], t; metadata = [ModelingToolkit.ProblemTypeCtx => "A"])
1574+
prob = ODEProblem(sys, [x => 1.0], (0.0, 1.0))
1575+
@test prob.problem_type == "A"
1576+
end

0 commit comments

Comments
 (0)