Skip to content

Commit e037aec

Browse files
committed
add test for power block
1 parent 4a9ac36 commit e037aec

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/Blocks/math.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,25 @@ end
157157
@test sol[prod.output.u] 2 * sin.(2 * pi * sol.t)
158158
end
159159

160+
@testset "Power" begin
161+
@named c1 = Constant(; k = 2)
162+
@named c2 = Constant(; k = 2)
163+
@named pow = Power(;)
164+
@named model = ODESystem(
165+
[
166+
connect(c1.output, pow.input1),
167+
connect(c2.output, pow.input2)
168+
],
169+
t,
170+
systems = [pow, c1, c2])
171+
sys = structural_simplify(model)
172+
prob = ODEProblem(sys, [], (0.0, 1.0))
173+
sol = solve(prob, Rodas4())
174+
@test isequal(unbound_inputs(sys), [])
175+
@test sol.retcode == Success
176+
@test sol[pow.output.u] 4
177+
end
178+
160179
@testset "Division" begin
161180
@named c1 = Sine(; frequency = 1)
162181
@named c2 = Constant(; k = 2)

0 commit comments

Comments
 (0)