Skip to content

Commit

Permalink
Enhancing robustness of some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasvarga committed Jan 23, 2024
1 parent 3343520 commit 42c926b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/test_conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,24 +343,26 @@ C = [0.0 0.0 0.0 1.0 0.0 0.0]

sys = dss(A,B,C,0)
@time sys_scaled, D1, D2 = gprescale(sys);
@test iszero(sys_scaled-sys) && gpole(sys) gpole(sys_scaled)
ev = gpole(sys); evs = gpole(sys_scaled);
@test iszero(sys_scaled-sys) && sort(real(ev)) sort(real(evs)) && sort(imag(ev)) sort(imag(evs))
@test sys_scaled.A == D1*sys.A*D2 && sys_scaled.B == D1*sys.B && sys_scaled.C == sys.C*D2
@test gbalqual(sys) > 100000*gbalqual(sys_scaled)

@time sys_scaled, D1, D2 = gprescale(sys,withB = false, withC = false);
@test iszero(sys_scaled-sys) && gpole(sys) gpole(sys_scaled)
evs = gpole(sys_scaled);
@test iszero(sys_scaled-sys) && sort(real(ev)) sort(real(evs)) && sort(imag(ev)) sort(imag(evs))
@test sys_scaled.A == D1*sys.A*D2 && sys_scaled.B == D1*sys.B && sys_scaled.C == sys.C*D2
@test gbalqual(sys) > 100000*gbalqual(sys_scaled)


sys1, sys2 = gsdec(sys_scaled,job="stable");
@test iszero(sys-sys1-sys2) && iszero(sys2)
@test iszero(sys-sys1-sys2,atol=1.e-7) && iszero(sys2,atol=1.e-7)

sys1, sys2 = gsdec(sys,prescale = true, job="stable");
@test iszero(sys-sys1-sys2) && iszero(sys2)
@test iszero(sys-sys1-sys2,atol=1.e-7) && iszero(sys2,atol=1.e-7)

sys1, sys2 = gsdec(sys,job="stable");
@test iszero(sys-sys1-sys2) && iszero(sys2)
@test iszero(sys-sys1-sys2,atol=1.e-7) && iszero(sys2,atol=1.e-7)



Expand Down

0 comments on commit 42c926b

Please sign in to comment.