From bdcd6a7094bd1b2ec1c0e0ea275525aa898e25cd Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sun, 5 Jul 2026 12:37:12 -0400 Subject: [PATCH 1/3] test: improve `RungeKutta` coverage --- test/1_test_sim_model.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/1_test_sim_model.jl b/test/1_test_sim_model.jl index 51f5cecef..e2eabb750 100644 --- a/test/1_test_sim_model.jl +++ b/test/1_test_sim_model.jl @@ -265,6 +265,10 @@ end @test_throws ErrorException NonLinModel( (x,u,_,_)->linmodel1.A*x + linmodel1.Bu*u, (x,_)->linmodel1.C*x, Ts, 2, 4, 2, 1, solver=nothing) + + @test_throws ArgumentError RungeKutta(2) + @test_throws ArgumentError RungeKutta(0) + @test_throws ArgumentError RungeKutta(4, supersample=0) end @testitem "NonLinModel sim methods" setup=[SetupMPCtests] begin From b62fb220e0581eea7a818eec5db7b979c71286df Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sun, 5 Jul 2026 15:41:59 -0400 Subject: [PATCH 2/3] test: improve `LinearMPCext` coverage --- test/5_test_extensions.jl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/5_test_extensions.jl b/test/5_test_extensions.jl index cf0cabfc7..40ff79aba 100644 --- a/test/5_test_extensions.jl +++ b/test/5_test_extensions.jl @@ -177,3 +177,24 @@ end u_data1, u_data2 = sim_wr(model, mpc1, mpc2, N) @test u_data1 ≈ u_data2 atol=1e-2 rtol=1e-2 end + +@testitem "LinearMPCext unsupported features" setup=[SetupMPCtests] begin + using .SetupMPCtests, ControlSystemsBase, LinearAlgebra, JuMP, DAQP + import LinearMPC + model = LinModel(tf([2], [10, 1]), 3.0) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 1, 3])) + @test_nowarn LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 2, 3])) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hc=3, N_Hc=diagm([1, 2, 3])) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hp=3, L_Hp=diagm([1, 2, 3])) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = setconstraint!(LinMPC(model), c_ymin=[1], c_ymax=[0.5]) + @test_throws ErrorException LinearMPC.MPC(mpc) + optim = Model(DAQP.Optimizer) + mpc = setconstraint!(LinMPC(model; optim), c_ymin=[0.5], c_ymax=[0.5]) + @test_logs (:warn, + "LinearMPC only supports softness parameters c = 0 or 1.\n"* + "All constraints with c > 0 will be considered soft.") LinearMPC.MPC(mpc) +end \ No newline at end of file From 737f5af2a7f5e1fc1b70da210d9a91052363655a Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sun, 5 Jul 2026 16:59:28 -0400 Subject: [PATCH 3/3] test: debug tests --- test/5_test_extensions.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/5_test_extensions.jl b/test/5_test_extensions.jl index 40ff79aba..1384c0bd5 100644 --- a/test/5_test_extensions.jl +++ b/test/5_test_extensions.jl @@ -181,18 +181,18 @@ end @testitem "LinearMPCext unsupported features" setup=[SetupMPCtests] begin using .SetupMPCtests, ControlSystemsBase, LinearAlgebra, JuMP, DAQP import LinearMPC + optim = Model(DAQP.Optimizer) model = LinModel(tf([2], [10, 1]), 3.0) - mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 1, 3])) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 1, 3]); optim) @test_nowarn LinearMPC.MPC(mpc) - mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 2, 3])) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 2, 3]); optim) @test_throws ErrorException LinearMPC.MPC(mpc) - mpc = LinMPC(model, Hc=3, N_Hc=diagm([1, 2, 3])) + mpc = LinMPC(model, Hc=3, N_Hc=diagm([1, 2, 3]); optim) @test_throws ErrorException LinearMPC.MPC(mpc) - mpc = LinMPC(model, Hp=3, L_Hp=diagm([1, 2, 3])) + mpc = LinMPC(model, Hp=3, L_Hp=diagm([1, 2, 3]); optim) @test_throws ErrorException LinearMPC.MPC(mpc) - mpc = setconstraint!(LinMPC(model), c_ymin=[1], c_ymax=[0.5]) + mpc = setconstraint!(LinMPC(model; optim), c_ymin=[1], c_ymax=[0.5]) @test_throws ErrorException LinearMPC.MPC(mpc) - optim = Model(DAQP.Optimizer) mpc = setconstraint!(LinMPC(model; optim), c_ymin=[0.5], c_ymax=[0.5]) @test_logs (:warn, "LinearMPC only supports softness parameters c = 0 or 1.\n"*