Skip to content

Commit 4788685

Browse files
test: test new input output behavior
1 parent bd05034 commit 4788685

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/input_output_handling.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,20 @@ end
468468
x = [1.0]
469469
@test_nowarn f[1](x, u, p, 0.0)
470470
end
471+
472+
@testset "Observed inputs and outputs" begin
473+
@variables x(t) y(t) [input = true] z(t) [output = true]
474+
eqs = [D(x) ~ x + y + z
475+
y ~ z]
476+
@named sys = System(eqs, t)
477+
@test issetequal(ModelingToolkit.inputs(sys), [y])
478+
@test issetequal(ModelingToolkit.outputs(sys), [z])
479+
480+
ss1 = mtkcompile(sys, inputs = [y], outputs = [z])
481+
@test issetequal(ModelingToolkit.inputs(ss1), [y])
482+
@test issetequal(ModelingToolkit.outputs(ss1), [z])
483+
484+
ss2 = mtkcompile(sys, inputs = [z], outputs = [y])
485+
@test issetequal(ModelingToolkit.inputs(ss2), [z])
486+
@test issetequal(ModelingToolkit.outputs(ss2), [y])
487+
end

0 commit comments

Comments
 (0)