Skip to content

Commit 57349d8

Browse files
committed
test: added no-allocation tests for ExplicitMPC
1 parent 7b8b88e commit 57349d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/3_test_predictive_control.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,13 @@ end
425425
@testitem "ExplicitMPC moves and getinfo" setup=[SetupMPCtests] begin
426426
using .SetupMPCtests, ControlSystemsBase, LinearAlgebra
427427
mpc1 = ExplicitMPC(LinModel(tf(5, [2, 1]), 3), Nwt=[0], Hp=1000, Hc=1)
428-
r = [5]
429-
preparestate!(mpc1, [0])
428+
r, y = [5], [0]
429+
preparestate!(mpc1, y)
430430
u = moveinput!(mpc1, r)
431431
@test u [1] atol=1e-2
432432
u = mpc1(r)
433433
@test u [1] atol=1e-2
434+
@test @allocations(moveinput!(mpc1, r)) == 0
434435
info = getinfo(mpc1)
435436
@test info[:u] u
436437
@test info[:Ŷ][end] r[1] atol=1e-2

0 commit comments

Comments
 (0)