Skip to content

Commit c53968d

Browse files
test: test new input output behavior
1 parent ef11db2 commit c53968d

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
@@ -464,3 +464,20 @@ end
464464
x = [1.0]
465465
@test_nowarn f[1](x, u, p, 0.0)
466466
end
467+
468+
@testset "Observed inputs and outputs" begin
469+
@variables x(t) y(t) [input = true] z(t) [output = true]
470+
eqs = [D(x) ~ x + y + z
471+
y ~ z]
472+
@named sys = System(eqs, t)
473+
@test issetequal(ModelingToolkit.inputs(sys), [y])
474+
@test issetequal(ModelingToolkit.outputs(sys), [z])
475+
476+
ss1 = mtkcompile(sys, inputs = [y], outputs = [z])
477+
@test issetequal(ModelingToolkit.inputs(ss1), [y])
478+
@test issetequal(ModelingToolkit.outputs(ss1), [z])
479+
480+
ss2 = mtkcompile(sys, inputs = [z], outputs = [y])
481+
@test issetequal(ModelingToolkit.inputs(ss2), [z])
482+
@test issetequal(ModelingToolkit.outputs(ss2), [y])
483+
end

0 commit comments

Comments
 (0)