From 4d34709300834461d744a573267c6ff7cf429963 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Wed, 27 May 2020 13:02:42 +0200 Subject: [PATCH] Add Key frame assert to FrameBase::link --- src/frame/frame_base.cpp | 1 + test/gtest_has_state_blocks.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frame/frame_base.cpp b/src/frame/frame_base.cpp index fd2edab07..e0a7a9346 100644 --- a/src/frame/frame_base.cpp +++ b/src/frame/frame_base.cpp @@ -287,6 +287,7 @@ void FrameBase::link(TrajectoryBasePtr _trj_ptr) { assert(!is_removing_ && "linking a removed frame"); assert(this->getTrajectory() == nullptr && "linking an already linked frame"); + assert(isKey() && "Trying to link a non keyframe"); if(_trj_ptr) { diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp index 6b403ea31..36c037f56 100644 --- a/test/gtest_has_state_blocks.cpp +++ b/test/gtest_has_state_blocks.cpp @@ -55,7 +55,7 @@ TEST_F(HasStateBlocksTest, Notifications_setKey_add) Notification n; ASSERT_FALSE(problem->getStateBlockNotification(sbp0, n)); - // F0->link(problem->getTrajectory()); + ASSERT_DEATH(F0->link(problem->getTrajectory()), "Assertion `isKey()"); // ASSERT_FALSE(problem->getStateBlockNotification(sbp0, n)); -- GitLab