Skip to content

Commit b9c5c77

Browse files
authored
Merge pull request #341 from JuliaControl/aqua
test: add `Aqua.jl` to the test suite
2 parents 20f8634 + 4c2d8e6 commit b9c5c77

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ModelPredictiveControl"
22
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
3-
version = "2.2.0"
3+
version = "2.2.1"
44
authors = ["Francis Gagnon"]
55

66
[deps]
@@ -30,6 +30,7 @@ LinearMPC = "82e1c212-e1a2-49d2-b26a-a31d6968e3bd"
3030
LinearMPCext = "LinearMPC"
3131

3232
[compat]
33+
Aqua = "0.8"
3334
ControlSystemsBase = "1.18.2"
3435
DAQP = "0.6, 0.7.1"
3536
DifferentiationInterface = "0.7.11"
@@ -53,11 +54,13 @@ SparseArrays = "1.10"
5354
SparseConnectivityTracer = "0.6.13, 1"
5455
SparseMatrixColorings = "0.4.14"
5556
StableRNGs = "1.0.4"
57+
Test = "1.10"
5658
TestItemRunner = "1"
5759
TestItems = "1"
5860
julia = "1.10"
5961

6062
[extras]
63+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
6164
DAQP = "c47d62df-3981-49c8-9651-128b1cd08617"
6265
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
6366
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
@@ -68,4 +71,4 @@ TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
6871
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
6972

7073
[targets]
71-
test = ["Test", "TestItems", "TestItemRunner", "Documenter", "Plots", "DAQP", "FiniteDiff", "LinearMPC"]
74+
test = ["Test", "TestItems", "TestItemRunner", "Documenter", "Plots", "DAQP", "FiniteDiff", "LinearMPC", "Aqua"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Build Status](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/CI.yml?query=branch%3Amain)
44
[![codecov](https://codecov.io/gh/JuliaControl/ModelPredictiveControl.jl/branch/main/graph/badge.svg?token=K4V0L113M4)](https://codecov.io/gh/JuliaControl/ModelPredictiveControl.jl)
5+
[![Aqua QA](https://juliatesting.github.io/Aqua.jl/dev/assets/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
56
[![doc-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaControl.github.io/ModelPredictiveControl.jl/stable)
67
[![doc-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaControl.github.io/ModelPredictiveControl.jl/dev)
78
[![arXiv](https://img.shields.io/badge/arXiv-2411.09764-b31b1b.svg)](https://arxiv.org/abs/2411.09764)
@@ -92,7 +93,7 @@ for more detailed examples.
9293
- 📝 **Transcription**: Direct single/multiple shooting and trapezoidal/orthogonal collocation.
9394
- 🩺 **Troubleshooting**: Detailed diagnostic information about optimum.
9495
- ⏱️ **Real-Time**: Optimized for low memory allocations with soft real-time utilities.
95-
- 📟️ **Embedded**: Lightweight C code generation via `LinearMPC.jl`
96+
- 📟️ **Embedded**: Lightweight C code generation via `LinearMPC.jl`.
9697

9798
### 🔭 State Estimation Features
9899

src/controller/transcription.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ end
709709

710710
@doc raw"""
711711
init_defectmat(
712-
model::SimModel, ::StateEstimator, ::TranscriptionMethod, Hp, Hc, _
712+
model::SimModel, estim::StateEstimator, ::TranscriptionMethod, Hp, Hc, _
713713
) -> ES, GS, JS, KS, VS, BS
714714
715715
Init the matrices for computing the defects of the stochastic states only.
@@ -751,7 +751,8 @@ The matrices ``\mathbf{E_S}`` and ``\mathbf{K_S}`` are defined in the Extended H
751751
- else ``\mathbf{E_S} = [\begin{smallmatrix} \mathbf{E_{S}^{Δu}} & \mathbf{E_{S}^{x̂}} \end{smallmatrix}]``
752752
"""
753753
function init_defectmat(
754-
model::SimModel, estim::StateEstimator{NT}, transcription::TranscriptionMethod, Hp, Hc, _
754+
model::SimModel, estim::StateEstimator{NT}, transcription::TranscriptionMethod,
755+
Hp, Hc, _
755756
) where {NT<:Real}
756757
nu, nx, nd, nx̂, nxs = model.nu, model.nx, model.nd, estim.nx̂, estim.nxs
757758
nZ = get_nZ(estim, transcription, Hp, Hc)
@@ -780,20 +781,20 @@ end
780781

781782
"""
782783
init_defectmat(
783-
model::SimModel, estim::InternalModel, ::TranscriptionMethod, Hp, Hc, _
784+
model::NonLinModel, estim::InternalModel, ::TranscriptionMethod, Hp, Hc, _
784785
) -> ES, GS, JS, KS, VS, BS
785786
786787
Return empty matrices for [`InternalModel`](@ref) (the state vector is not augmented).
787788
"""
788789
function init_defectmat(
789-
::SimModel, estim::InternalModel, transcription::TranscriptionMethod, Hp, Hc, _
790+
::NonLinModel, estim::InternalModel, transcription::TranscriptionMethod, Hp, Hc, _
790791
)
791792
return init_defectmat_empty(estim, transcription, Hp, Hc)
792793
end
793794

794795
"""
795796
init_defectmat(
796-
model::SimModel, estim::StateEstimator, ::TranscriptionMethod, Hp, Hc, nb
797+
model::SimModel, estim::StateEstimator, transcription::SingleShooting, Hp, Hc, _
797798
) -> ES, GS, JS, KS, VS, BS
798799
799800
Return empty matrices for [`SingleShooting`](@ref) transcription (N/A).
@@ -805,11 +806,12 @@ function init_defectmat(
805806
end
806807

807808
function init_defectmat(
808-
::SimModel, estim::InternalModel, transcription::SingleShooting, Hp, Hc, _
809+
::NonLinModel, estim::InternalModel, transcription::SingleShooting, Hp, Hc, _
809810
)
810811
return init_defectmat_empty(estim, transcription, Hp, Hc)
811812
end
812813

814+
813815
function init_defectmat_empty(
814816
estim::StateEstimator{NT}, transcription::TranscriptionMethod, Hp, Hc
815817
) where {NT<:Real}
@@ -1067,10 +1069,10 @@ function linconstrainteq!(
10671069
return nothing
10681070
end
10691071
"No linear equality constraints for [`InternalModel`](@ref) (state is not augmented)."
1070-
linconstrainteq!(::PredictiveController, ::SimModel, ::InternalModel, ::TranscriptionMethod) = nothing
1072+
linconstrainteq!(::PredictiveController, ::NonLinModel, ::InternalModel, ::TranscriptionMethod) = nothing
10711073
"No linear equality constraints for [`SingleShooting`(@ref) (N/A).]"
1072-
linconstrainteq!(::PredictiveController, ::SimModel, ::StateEstimator, ::SingleShooting) = nothing
1073-
linconstrainteq!(::PredictiveController, ::SimModel, ::InternalModel, ::SingleShooting) = nothing
1074+
linconstrainteq!(::PredictiveController, ::SimModel, ::StateEstimator, ::SingleShooting) = nothing
1075+
linconstrainteq!(::PredictiveController, ::NonLinModel, ::InternalModel, ::SingleShooting) = nothing
10741076

10751077
@doc raw"""
10761078
set_warmstart!(mpc::PredictiveController, ::SingleShooting, Z̃var) -> Z̃s

test/7_test_aqua.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@testitem "Aqua" begin
2+
using Aqua
3+
# All the functions defined inside `ModelPredictiveControl.get_nonlinobj_op` with the
4+
# `Vararg`s have unbound type parameters. This is necessary for the splatting syntax of
5+
# `JuMP.@operator`, and JuMP will never call these functions with 0 argument, so
6+
# defining zero-argument methods would be useless, so I disable this check here.
7+
unbound_args = false
8+
Aqua.test_all(ModelPredictiveControl; unbound_args)
9+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ include("3_test_predictive_control.jl")
1010
include("4_test_plot_sim.jl")
1111
include("5_test_extensions.jl")
1212
include("6_test_doctest.jl")
13+
include("7_test_aqua.jl")
1314

1415
nothing

0 commit comments

Comments
 (0)