Skip to content

Commit

Permalink
test: add a test to verify the initial val of capacitor.v
Browse files Browse the repository at this point in the history
  • Loading branch information
ven-k committed Jul 4, 2023
1 parent 4d674c3 commit a1a02a2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/model_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ end
@parameters begin
C
end
@variables begin
v = 0.0
end
@extend v, i = oneport = OnePort(; v = v)
@extend v, i = oneport = OnePort(; v = 0.0)
@icon "https://upload.wikimedia.org/wikipedia/commons/7/78/Capacitor_symbol.svg"
@equations begin
D(v) ~ i / C
end
end

@named capacitor = Capacitor(C = 10, oneport.v = 10.0)
@test getdefault(capacitor.v) == 10.0

@mtkmodel Voltage begin
@extend v, i = oneport = OnePort()
@components begin
Expand Down Expand Up @@ -136,6 +136,7 @@ end
@named rc = RC(; resistor.R = 20)
@test getdefault(rc.resistor.R) == 20
@test getdefault(rc.capacitor.C) == 10
@test getdefault(rc.capacitor.v) == 0.0
@test getdefault(rc.constant.k) == 1

@test get_gui_metadata(rc.resistor).layout == Resistor.structure[:icon] ==
Expand Down

0 comments on commit a1a02a2

Please sign in to comment.