Skip to content

Commit cd0f04a

Browse files
committed
Add tests
1 parent c3c030e commit cd0f04a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/model_parsing.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ModelingToolkit, Test
22
using ModelingToolkit: get_gui_metadata,
3-
VariableDescription, getdefault, RegularConnector, get_ps
3+
VariableDescription, getdefault, RegularConnector, get_ps, getname
44
using URIs: URI
55
using Distributions
66
using Unitful
@@ -146,7 +146,11 @@ l15 0" stroke="black" stroke-width="1" stroke-linejoin="bevel" fill="none"></pat
146146
C_val = 20
147147
R_val = 20
148148
res__R = 100
149-
@named rc = RC(; C_val, R_val, resistor.R = res__R)
149+
@mtkbuild rc = RC(; C_val, R_val, resistor.R = res__R)
150+
resistor = getproperty(rc, :resistor; namespace = false)
151+
@test getname(rc.resistor) === getname(resistor)
152+
@test getname(rc.resistor.R) === getname(resistor.R)
153+
@test getname(rc.resistor.v) === getname(resistor.v)
150154
# Test that `resistor.R` overrides `R_val` in the argument.
151155
@test getdefault(rc.resistor.R) == res__R != R_val
152156
# Test that `C_val` passed via argument is set as default of C.
@@ -166,7 +170,7 @@ l15 0" stroke="black" stroke-width="1" stroke-linejoin="bevel" fill="none"></pat
166170
@test ModelingToolkit.get_gui_metadata(rc.resistor.p).layout == Pin.structure[:icon] ==
167171
URI("file:///" * abspath(ENV["MTK_ICONS_DIR"], "pin.png"))
168172

169-
@test length(equations(structural_simplify(rc))) == 1
173+
@test length(equations(rc)) == 1
170174
end
171175

172176
@testset "Parameters and Structural parameters in various modes" begin

0 commit comments

Comments
 (0)