Skip to content

Commit 1371014

Browse files
committed
Also add test from originally reported issue
1 parent ded3046 commit 1371014

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/odesystem.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,11 +1196,19 @@ end
11961196
end
11971197

11981198
# https://github.com/SciML/ModelingToolkit.jl/issues/2818
1199-
@testset "Independent variable must be a parameter" begin
1199+
@testset "Custom independent variable" begin
12001200
@parameters x
12011201
@variables y(x)
12021202
@test_nowarn @named sys = ODESystem([y ~ 0], x)
12031203

12041204
@variables x y(x)
12051205
@test_throws ArgumentError @named sys = ODESystem([y ~ 0], x)
1206+
1207+
@parameters T
1208+
D = Differential(T)
1209+
@variables x(T)
1210+
@named sys2 = ODESystem([D(x) ~ 0], T; initialization_eqs = [x ~ T], guesses = [x => 0.0])
1211+
prob2 = ODEProblem(structural_simplify(sys2), [], (1.0, 2.0), [])
1212+
sol2 = solve(prob2)
1213+
@test all(sol2[x] .== 1.0)
12061214
end

0 commit comments

Comments
 (0)