Skip to content

Commit 820684b

Browse files
committed
test: connector with parameters, equations, icon, components, equations
1 parent 90fb063 commit 820684b

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

test/model_parsing.jl

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using ModelingToolkit, Test
2-
using ModelingToolkit: get_gui_metadata, VariableDescription, getdefault
2+
using ModelingToolkit: get_gui_metadata, VariableDescription, getdefault, RegularConnector
33
using URIs: URI
44
using Distributions
55
using Unitful
@@ -233,3 +233,41 @@ end
233233
for (k, v) in metadata
234234
@test MockMeta.structure[:variables][:m][k] == v
235235
end
236+
237+
@testset "Connector with parameters, equations..." begin
238+
@connector A begin
239+
@extend (e,) = extended_e = E()
240+
@icon "pin.png"
241+
@parameters begin
242+
p
243+
end
244+
@variables begin
245+
v(t)
246+
end
247+
@components begin
248+
cc = C()
249+
end
250+
@equations begin
251+
e ~ 0
252+
end
253+
end
254+
255+
@connector C begin
256+
c(t)
257+
end
258+
259+
@connector E begin
260+
e(t)
261+
end
262+
263+
@named aa = A()
264+
@test aa.connector_type == RegularConnector()
265+
266+
@test A.isconnector == true
267+
268+
@test A.structure[:parameters] == Dict(:p => Dict())
269+
@test A.structure[:extend] == [[:e], :extended_e, :E]
270+
@test A.structure[:equations] == ["e ~ 0"]
271+
@test A.structure[:kwargs] == Dict(:p => nothing, :v => nothing)
272+
@test A.structure[:components] == [[:cc, :C]]
273+
end

0 commit comments

Comments
 (0)