Skip to content

Commit

Permalink
add test for zero constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Dec 4, 2023
1 parent 28c3712 commit 66e1475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/src/types/LFTSystem.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
abstract type LFTSystem{TE, T} <: LTISystem{TE} end
timeevol(sys::LFTSystem) = timeevol(sys.P)

Base.zero(sys::LFTSystem) = basetype(sys)(zero(sys.D), sys.timeevol)
Base.zero(sys::LFTSystem) = ss(zero(sys.P.D), sys.P.timeevol)
Base.zero(::Type{<:LFTSystem{Continuous, F}}) where {F} = ss([zero(F)], Continuous())

Check warning on line 5 in lib/ControlSystemsBase/src/types/LFTSystem.jl

View check run for this annotation

Codecov / codecov/patch

lib/ControlSystemsBase/src/types/LFTSystem.jl#L4-L5

Added lines #L4 - L5 were not covered by tests


Expand Down
6 changes: 4 additions & 2 deletions lib/ControlSystemsBase/test/test_delayed_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ P2_fr = (im*ω .+ 1) ./ (im*ω .+ 2)
@test freqresp(P2 * delay(1), ω)[:] P2_fr .* exp.(-im*ω) rtol=1e-15
@test freqresp(delay(1) * P2, ω)[:] P2_fr .* exp.(-im*ω) rtol=1e-15


# Division / feedback
## Division / feedback
@test freqresp(1/(1+P1), ω) freqresp(feedback(I(size(P1, 1)), P1), ω) rtol=1e-15

## Zero
@test zero(typeof(P1)) == ss(0.0)
@test zero(P1) == ss(0.0)

## append
P12 = append(P1, P2)
Expand Down

0 comments on commit 66e1475

Please sign in to comment.