Skip to content

Commit c66a92f

Browse files
test: test improved causal variable connection semantics
1 parent a4bc034 commit c66a92f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/causal_variables_connection.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,34 @@ end
9090
@test matrices.D[] == 0
9191
end
9292
end
93+
94+
@testset "Outside input to inside input connection" begin
95+
@mtkmodel Inner begin
96+
@variables begin
97+
x(t), [input = true]
98+
y(t), [output = true]
99+
end
100+
@equations begin
101+
y ~ x
102+
end
103+
end
104+
@mtkmodel Outer begin
105+
@variables begin
106+
u(t), [input = true]
107+
v(t), [output = true]
108+
end
109+
@components begin
110+
inner = Inner()
111+
end
112+
@equations begin
113+
connect(u, inner.x)
114+
connect(inner.y, v)
115+
end
116+
end
117+
@named sys = Outer()
118+
ss = toggle_namespacing(sys, false)
119+
eqs = equations(expand_connections(sys))
120+
@test issetequal(eqs, [ss.u ~ ss.inner.x
121+
ss.inner.y ~ ss.inner.x
122+
ss.inner.y ~ ss.v])
123+
end

0 commit comments

Comments
 (0)