diff --git a/test/input_output_handling.jl b/test/input_output_handling.jl index d5179c2296..19078bc98c 100644 --- a/test/input_output_handling.jl +++ b/test/input_output_handling.jl @@ -171,16 +171,6 @@ x = [rand()] u = [rand()] @test f[1](x, u, p, 1) == -x + u -@testset "Constants substitution" begin - @constants c = 2.0 - @variables x(t) - eqs = [D(x) ~ c * x] - @named sys = ODESystem(eqs, t, [x], []) - - f, dvs, ps = ModelingToolkit.generate_control_function(sys, simplify = true) - @test f[1]([0.5], nothing, nothing, 0.0) == [1.0] -end - # more complicated system @variables u(t) [input = true] @@ -401,3 +391,14 @@ matrices, ssys = linearize(augmented_sys, io_sys, [x + u * t]; inputs = [u]) @test obsfn([1.0], [2.0], nothing, 3.0) == [7.0] end + +# https://github.com/SciML/ModelingToolkit.jl/issues/2896 +@testset "Constants substitution" begin + @constants c = 2.0 + @variables x(t) + eqs = [D(x) ~ c * x] + @named sys = ODESystem(eqs, t, [x], []) + + f, dvs, ps = ModelingToolkit.generate_control_function(sys, simplify = true) + @test f[1]([0.5], nothing, nothing, 0.0) == [1.0] +end