Skip to content

Commit 0697a6c

Browse files
test: test source information propagation through expand_connections
1 parent 45e4843 commit 0697a6c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/ModelingToolkitBase/test/components.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,35 @@ end
388388
# as opposed to `output.u ~ input.u`
389389
@test isequal(eq, comp1.input.u ~ comp2.output.u)
390390
end
391+
392+
@testset "Source information propagation through `expand_connections`" begin
393+
@named rc_model = RCModel()
394+
sys, source_info = expand_connections(rc_model, Val(true))
395+
@test source_info.eqs_source == [
396+
[:rc_model, :resistor],
397+
[:rc_model, :resistor],
398+
[:rc_model, :resistor],
399+
[:rc_model, :resistor],
400+
[:rc_model, :capacitor],
401+
[:rc_model, :capacitor],
402+
[:rc_model, :capacitor],
403+
[:rc_model, :capacitor],
404+
[:rc_model, :shape],
405+
[:rc_model, :source],
406+
[:rc_model, :source],
407+
[:rc_model, :source],
408+
[:rc_model, :source],
409+
[:rc_model, :ground],
410+
Symbol[],
411+
Symbol[],
412+
Symbol[],
413+
Symbol[],
414+
Symbol[],
415+
Symbol[],
416+
Symbol[],
417+
Symbol[]
418+
]
419+
is_connect_truth = falses(22)
420+
is_connect_truth[end-7:end] .= true
421+
@test source_info.is_connection_equation == is_connect_truth
422+
end

0 commit comments

Comments
 (0)