Skip to content

Commit 0a9f119

Browse files
committed
Add failing test case.
1 parent 081592f commit 0a9f119

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/runtests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,27 @@ end
214214
@test did_callback2
215215
end
216216

217+
@testset "lcm_handle allocations" begin
218+
data = UInt8[1,2,3,4,5]
219+
channel = "CHANNEL_1"
220+
221+
# start listening
222+
sublcm = LCM()
223+
sub = subscribe(sublcm, channel, (c, d) -> nothing)
224+
set_queue_capacity(sub, 2)
225+
226+
# publish two messages
227+
publcm = LCM()
228+
for _ = 1 : 2
229+
publish(publcm, channel, data)
230+
end
231+
232+
# check that handling doesn't allocate
233+
LCMCore.lcm_handle(sublcm)
234+
allocs = @allocated LCMCore.lcm_handle(sublcm)
235+
@test allocs == 0
236+
end
237+
217238
include("test_lcmtype.jl")
218239
include("test_readlog.jl")
219240

0 commit comments

Comments
 (0)